Beispiel #1
0
 def setUp(self):
     super().setUp()
     # Disable marketing site password just to save us from having to mock the responses
     self.partner = factories.PartnerFactory(
         marketing_site_api_password=None)
     self.person = factories.PersonFactory(partner=self.partner,
                                           given_name='Person')
     self.target = factories.PersonFactory(partner=self.partner,
                                           given_name='Target')
     self.instructor1 = factories.PersonFactory(partner=self.partner,
                                                given_name='Instructor1')
     self.instructor2 = factories.PersonFactory(partner=self.partner,
                                                given_name='Instructor2')
     self.instructor3 = factories.PersonFactory(partner=self.partner,
                                                given_name='Instructor3')
     self.position = factories.PositionFactory(person=self.person)
     self.social1 = factories.PersonSocialNetworkFactory(person=self.person)
     self.social2 = factories.PersonSocialNetworkFactory(person=self.person)
     self.endorsement = factories.EndorsementFactory(endorser=self.person)
     self.course = factories.CourseFactory(partner=self.partner)
     self.courserun1 = factories.CourseRunFactory(course=self.course,
                                                  staff=[
                                                      self.instructor1,
                                                      self.person,
                                                      self.instructor2,
                                                      self.instructor3,
                                                  ])
     self.courserun2 = factories.CourseRunFactory(course=self.course,
                                                  staff=[
                                                      self.instructor1,
                                                      self.instructor2,
                                                      self.person,
                                                      self.instructor3,
                                                  ])
     self.program = factories.ProgramFactory(courses=[self.course],
                                             instructor_ordering=[
                                                 self.person,
                                                 self.instructor1,
                                                 self.instructor2,
                                                 self.instructor3,
                                             ])
     self.publisher_course = publisher_factories.CourseFactory()
     self.publisher_courserun1 = publisher_factories.CourseRunFactory(
         course=self.publisher_course,
         staff=[
             self.person,
             self.instructor1,
             self.instructor2,
             self.instructor3,
         ])
     self.publisher_courserun2 = publisher_factories.CourseRunFactory(
         course=self.publisher_course,
         staff=[
             self.instructor1,
             self.instructor2,
             self.instructor3,
             self.person,
         ])
Beispiel #2
0
 def setUp(self):
     self.course_runs = factories.CourseRunFactory.create_batch(3)
     self.course = self.course_runs[0].course
     self.program_type = ProgramType.objects.get(slug='masters')
     self.partner = factories.PartnerFactory()
     self.degree = factories.DegreeFactory(courses=[self.course],
                                           type=self.program_type,
                                           partner=self.partner)
     self.curriculum = Curriculum.objects.create(program=self.degree,
                                                 uuid=uuid.uuid4())
    def setUp(self):
        super().setUp()

        # Disable marketing site password just to save us from having to mock the responses
        self.partner = factories.PartnerFactory(marketing_site_api_password=None)

        # Fill out a bunch of types and modes. Exact mode parameters don't matter, just the resulting seat types.
        self.audit_seat_type = factories.SeatTypeFactory.audit()
        self.verified_seat_type = factories.SeatTypeFactory.verified()
        self.audit_mode = Mode.objects.get(slug=Seat.AUDIT)
        self.verified_mode = Mode.objects.get(slug=Seat.VERIFIED)
        self.audit_track = Track.objects.get(seat_type=self.audit_seat_type, mode=self.audit_mode)
        self.verified_track = Track.objects.get(seat_type=self.verified_seat_type, mode=self.verified_mode)
        self.empty_run_type = CourseRunType.objects.get(slug=CourseRunType.EMPTY)
        self.audit_run_type = CourseRunType.objects.get(slug=CourseRunType.AUDIT)
        self.va_run_type = CourseRunType.objects.get(slug=CourseRunType.VERIFIED_AUDIT)
        self.empty_course_type = CourseType.objects.get(slug=CourseType.EMPTY)
        self.va_course_type = CourseType.objects.get(slug=CourseType.VERIFIED_AUDIT)
        self.audit_course_type = CourseType.objects.get(slug=CourseType.AUDIT)

        # Now create some courses and orgs that will be found to match the above, in the simple happy path case.
        self.org = factories.OrganizationFactory(partner=self.partner, key='Org1')
        self.course = factories.CourseFactory(partner=self.partner, authoring_organizations=[self.org],
                                              type=self.empty_course_type,
                                              key=f'{self.org.key}+Course1')
        self.entitlement = factories.CourseEntitlementFactory(partner=self.partner, course=self.course,
                                                              mode=self.verified_seat_type)
        self.audit_run = factories.CourseRunFactory(course=self.course, type=self.empty_run_type,
                                                    key='course-v1:Org1+Course1+A')
        self.audit_seat = factories.SeatFactory(course_run=self.audit_run, type=self.audit_seat_type)
        self.verified_run = factories.CourseRunFactory(course=self.course, type=self.empty_run_type,
                                                       key='course-v1:Org1+Course1+V')
        self.verified_seat = factories.SeatFactory(course_run=self.verified_run, type=self.verified_seat_type)
        self.verified_audit_seat = factories.SeatFactory(course_run=self.verified_run, type=self.audit_seat_type)

        # Create parallel obj / course for argument testing
        self.org2 = factories.OrganizationFactory(partner=self.partner, key='Org2')
        self.org3 = factories.OrganizationFactory(partner=self.partner, key='Org3')
        self.course2 = factories.CourseFactory(partner=self.partner, authoring_organizations=[self.org2, self.org3],
                                               type=self.empty_course_type,
                                               key=f'{self.org2.key}+Course1')
        self.c2_audit_run = factories.CourseRunFactory(course=self.course2, type=self.empty_run_type)
        self.c2_audit_seat = factories.SeatFactory(course_run=self.c2_audit_run, type=self.audit_seat_type)