コード例 #1
0
    def setUpTestData(cls):
        cls.user = SocialUserFactory.create()

        cls.run_fa = CourseRunFactory.create(
            freeze_grade_date=now_in_utc() - timedelta(days=1),
            course__program__financial_aid_availability=True,
        )
        cls.run_fa_with_cert = CourseRunFactory.create(
            freeze_grade_date=None,
            course__program=cls.run_fa.course.program,
        )

        cls.run_no_fa = CourseRunFactory.create(
            freeze_grade_date=now_in_utc() + timedelta(days=1),
            course__program__financial_aid_availability=False,
        )
        cls.run_no_fa_with_cert = CourseRunFactory.create(
            course__program=cls.run_no_fa.course.program, )

        all_course_runs = (
            cls.run_fa,
            cls.run_fa_with_cert,
            cls.run_no_fa,
            cls.run_no_fa_with_cert,
        )

        for run in all_course_runs:
            if run.course.program.financial_aid_availability:
                FinancialAidFactory.create(
                    user=cls.user,
                    tier_program=TierProgramFactory.create(
                        program=run.course.program,
                        income_threshold=0,
                        current=True),
                    status=FinancialAidStatus.RESET,
                )

        cls.enrollments = {
            course_run.edx_course_key:
            CachedEnrollmentFactory.create(user=cls.user,
                                           course_run=course_run)
            for course_run in all_course_runs
        }

        cls.current_grades = {
            course_run.edx_course_key:
            CachedCurrentGradeFactory.create(user=cls.user,
                                             course_run=course_run)
            for course_run in all_course_runs
        }

        cls.certificates = {
            course_run.edx_course_key:
            CachedCertificateFactory.create(user=cls.user,
                                            course_run=course_run)
            for course_run in (cls.run_fa_with_cert, cls.run_no_fa_with_cert)
        }

        cls.user_edx_data = CachedEdxUserData(cls.user)
コード例 #2
0
ファイル: api_test.py プロジェクト: mitodl/micromasters
 def setUpTestData(cls):
     cls.user = SocialUserFactory.create()
     cls.run_1 = CourseRunFactory.create(
         freeze_grade_date=now_in_utc()-timedelta(days=1),
         course__program__financial_aid_availability=True,
     )
     CourseRunGradingStatus.objects.create(course_run=cls.run_1, status='complete')
     cls.program = cls.run_1.course.program
コード例 #3
0
ファイル: api_test.py プロジェクト: mitodl/micromasters
    def setUpTestData(cls):
        cls.user = SocialUserFactory.create()

        cls.run_1 = CourseRunFactory.create(
            freeze_grade_date=now_in_utc()-timedelta(days=1),
            course__program__financial_aid_availability=True,
        )
        cls.program = cls.run_1.course.program
コード例 #4
0
    def setUpTestData(cls):
        cls.user = SocialUserFactory.create()

        cls.run_1 = CourseRunFactory.create(
            freeze_grade_date=now_in_utc()-timedelta(days=1),
            course__program__financial_aid_availability=True,
        )
        cls.program = cls.run_1.course.program
コード例 #5
0
 def setUpTestData(cls):
     cls.user = SocialUserFactory.create()
     cls.run_1 = CourseRunFactory.create(
         freeze_grade_date=now_in_utc()-timedelta(days=1),
         course__program__financial_aid_availability=True,
     )
     CourseRunGradingStatus.objects.create(course_run=cls.run_1, status='complete')
     cls.program = cls.run_1.course.program
コード例 #6
0
    def setUpTestData(cls):
        super(DashboardTokensTest, cls).setUpTestData()
        # create a user
        cls.user = SocialUserFactory.create(social_auth__extra_data=social_extra_data)
        cls.social_auth = cls.user.social_auth.first()
        cls.enrollments = Enrollments([])

        # url for the dashboard
        cls.url = reverse('dashboard_api', args=[cls.social_auth.uid])
コード例 #7
0
ファイル: views_test.py プロジェクト: mitodl/micromasters
    def setUpTestData(cls):
        super(DashboardTokensTest, cls).setUpTestData()
        # create a user
        cls.user = SocialUserFactory.create(social_auth__extra_data=social_extra_data)
        cls.social_auth = cls.user.social_auth.first()
        cls.enrollments = Enrollments([])

        # url for the dashboard
        cls.url = reverse('dashboard_api', args=[cls.social_auth.uid])
コード例 #8
0
    def setUpTestData(cls):
        cls.user = SocialUserFactory.create()

        cls.course_run = CourseRunFactory.create(
            course__program__financial_aid_availability=True)
        cls.exam_run = ExamRunFactory.create(
            course=cls.course_run.course,
            date_grades_available=now_in_utc() - timedelta(weeks=1))
        cls.not_passing_final_grade = FinalGradeFactory.create(
            user=cls.user, course_run=cls.course_run, grade=0.5, passed=False)
コード例 #9
0
    def setUpTestData(cls):
        super().setUpTestData()
        # create a user
        cls.user = SocialUserFactory.create()

        # create the course run
        cls.course_id = "edx+fake+key"
        cls.course_run = CourseRunFactory.create(edx_course_key=cls.course_id)

        # url for the dashboard
        cls.url = reverse('user_course_enrollments')
コード例 #10
0
ファイル: views_test.py プロジェクト: mitodl/micromasters
    def setUpTestData(cls):
        super().setUpTestData()
        # create a user
        cls.user = SocialUserFactory.create()

        # create the course run
        cls.course_id = "edx+fake+key"
        cls.course_run = CourseRunFactory.create(edx_course_key=cls.course_id)

        # url for the dashboard
        cls.url = reverse('user_course_enrollments')
コード例 #11
0
ファイル: api_test.py プロジェクト: mitodl/micromasters
    def setUpTestData(cls):
        cls.user = SocialUserFactory.create()

        cls.run_fa = CourseRunFactory.create(
            freeze_grade_date=now_in_utc()-timedelta(days=1),
            course__program__financial_aid_availability=True,
        )
        cls.run_fa_with_cert = CourseRunFactory.create(
            freeze_grade_date=None,
            course__program=cls.run_fa.course.program,
        )

        cls.run_no_fa = CourseRunFactory.create(
            freeze_grade_date=now_in_utc()+timedelta(days=1),
            course__program__financial_aid_availability=False,
        )
        cls.run_no_fa_with_cert = CourseRunFactory.create(
            course__program=cls.run_no_fa.course.program,
        )

        all_course_runs = (cls.run_fa, cls.run_fa_with_cert, cls.run_no_fa, cls.run_no_fa_with_cert, )

        for run in all_course_runs:
            if run.course.program.financial_aid_availability:
                FinancialAidFactory.create(
                    user=cls.user,
                    tier_program=TierProgramFactory.create(
                        program=run.course.program, income_threshold=0, current=True
                    ),
                    status=FinancialAidStatus.RESET,
                )

        cls.enrollments = {
            course_run.edx_course_key: CachedEnrollmentFactory.create(
                user=cls.user, course_run=course_run) for course_run in all_course_runs
        }

        cls.current_grades = {
            course_run.edx_course_key: CachedCurrentGradeFactory.create(
                user=cls.user, course_run=course_run) for course_run in all_course_runs
        }

        cls.certificates = {
            course_run.edx_course_key: CachedCertificateFactory.create(
                user=cls.user, course_run=course_run) for course_run in (cls.run_fa_with_cert, cls.run_no_fa_with_cert)
        }

        cls.user_edx_data = CachedEdxUserData(cls.user)
コード例 #12
0
ファイル: api_test.py プロジェクト: mitodl/micromasters
    def setUpTestData(cls):
        cls.user = SocialUserFactory.create()

        cls.course_run = CourseRunFactory.create(
            course__program__financial_aid_availability=True
        )
        cls.exam_run = ExamRunFactory.create(
            course=cls.course_run.course,
            date_grades_available=now_in_utc() - timedelta(weeks=1)
        )
        cls.not_passing_final_grade = FinalGradeFactory.create(
            user=cls.user,
            course_run=cls.course_run,
            grade=0.5,
            passed=False
        )
コード例 #13
0
    def setUpTestData(cls):
        super(DashboardTest, cls).setUpTestData()
        # create a user
        cls.user = SocialUserFactory.create()
        UserCacheRefreshTimeFactory(user=cls.user, unexpired=True)

        # create the programs
        cls.program_1 = ProgramFactory.create(live=True)
        cls.program_2 = ProgramFactory.create(live=True)
        cls.program_not_enrolled = ProgramFactory.create(live=True)
        cls.program_no_live = ProgramFactory.create(live=False)

        # enroll the user in some courses
        for program in [cls.program_1, cls.program_2, cls.program_no_live]:
            ProgramEnrollment.objects.create(
                user=cls.user,
                program=program
            )

        # url for the dashboard
        cls.url = reverse('dashboard_api', args=[cls.user.social_auth.first().uid])
コード例 #14
0
ファイル: views_test.py プロジェクト: mitodl/micromasters
    def setUpTestData(cls):
        super(DashboardTest, cls).setUpTestData()
        # create a user
        cls.user = SocialUserFactory.create()
        UserCacheRefreshTimeFactory(user=cls.user, unexpired=True)

        # create the programs
        cls.program_1 = ProgramFactory.create(live=True)
        cls.program_2 = ProgramFactory.create(live=True)
        cls.program_not_enrolled = ProgramFactory.create(live=True)
        cls.program_no_live = ProgramFactory.create(live=False)

        # enroll the user in some courses
        for program in [cls.program_1, cls.program_2, cls.program_no_live]:
            ProgramEnrollment.objects.create(
                user=cls.user,
                program=program
            )

        # url for the dashboard
        cls.url = reverse('dashboard_api', args=[cls.user.social_auth.first().uid])
コード例 #15
0
ファイル: views_test.py プロジェクト: mitodl/micromasters
 def setUpTestData(cls):
     super(BackendViewTest, cls).setUpTestData()
     # create a user
     cls.user = SocialUserFactory.create()
     UserCacheRefreshTimeFactory(user=cls.user, unexpired=True)
     cls.url = reverse('social:complete', args=['edxorg'])
コード例 #16
0
 def setUpTestData(cls):
     cls.user = SocialUserFactory.create(social_auth__extra_data=social_extra_data)
     cls.invalid_user = UserFactory.create()
     cls.url = reverse('unenroll_programs')
コード例 #17
0
ファイル: views_test.py プロジェクト: mitodl/micromasters
 def setUpTestData(cls):
     cls.user = SocialUserFactory.create(social_auth__extra_data=social_extra_data)
     cls.invalid_user = UserFactory.create()
     cls.url = reverse('unenroll_programs')
コード例 #18
0
 def setUpTestData(cls):
     super(BackendViewTest, cls).setUpTestData()
     # create a user
     cls.user = SocialUserFactory.create()
     UserCacheRefreshTimeFactory(user=cls.user, unexpired=True)
     cls.url = reverse('social:complete', args=['edxorg'])