def test_same_user_key_in_multiple_organizations(self): uox_program_enrollment = self._create_waiting_program_enrollment() second_organization = OrganizationFactory.create() SAMLProviderConfigFactory.create(organization=second_organization, slug='aiu') catalog_org = CatalogOrganizationFactory.create( key=second_organization.short_name) program_uuid = self._create_catalog_program(catalog_org)['uuid'] # aiu enrollment with the same student key as our uox user aiu_program_enrollment = ProgramEnrollmentFactory.create( user=None, external_user_key=self.external_id, program_uuid=program_uuid) UserSocialAuth.objects.create( user=UserFactory.create(), uid='{0}:{1}'.format('not_used', self.external_id), ) UserSocialAuth.objects.create( user=self.user, uid='{0}:{1}'.format(self.provider_slug, self.external_id), ) self._assert_program_enrollment_user(uox_program_enrollment, self.user) aiu_user = UserFactory.create() UserSocialAuth.objects.create( user=aiu_user, uid='{0}:{1}'.format('aiu', self.external_id), ) self._assert_program_enrollment_user(aiu_program_enrollment, aiu_user)
def test_same_user_key_in_multiple_organizations(self): uox_program_enrollment = self._create_waiting_program_enrollment() second_organization = OrganizationFactory.create() SAMLProviderConfigFactory.create(organization=second_organization, slug='aiu') catalog_org = CatalogOrganizationFactory.create(key=second_organization.short_name) program_uuid = self._create_catalog_program(catalog_org)['uuid'] # aiu enrollment with the same student key as our uox user aiu_program_enrollment = ProgramEnrollmentFactory.create( user=None, external_user_key=self.external_id, program_uuid=program_uuid ) UserSocialAuth.objects.create( user=UserFactory.create(), uid='{0}:{1}'.format('not_used', self.external_id), ) UserSocialAuth.objects.create( user=self.user, uid='{0}:{1}'.format(self.provider_slug, self.external_id), ) self._assert_program_enrollment_user(uox_program_enrollment, self.user) aiu_user = UserFactory.create() UserSocialAuth.objects.create( user=aiu_user, uid='{0}:{1}'.format('aiu', self.external_id), ) self._assert_program_enrollment_user(aiu_program_enrollment, aiu_user)
def setUp(self): super(GetUsersByExternalKeysTests, self).setUp() catalog_org = CatalogOrganizationFactory.create(key=self.organization_key) program = ProgramFactory.create( uuid=self.program_uuid, authoring_organizations=[catalog_org] ) cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=self.program_uuid), program, None)
def setup_catalog_cache(self, program_uuid, organization_key): """ helper function to initialize a cached program with an single authoring_organization """ catalog_org = CatalogOrganizationFactory.create(key=organization_key) program = ProgramFactory.create(uuid=program_uuid, authoring_organizations=[catalog_org]) cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=program_uuid), program, None)
def setup_catalog_cache(self, program_uuid, organization_key): """ helper function to initialize a cached program with an single authoring_organization """ catalog_org = CatalogOrganizationFactory.create(key=organization_key) program = ProgramFactory.create( uuid=program_uuid, authoring_organizations=[catalog_org] ) cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=program_uuid), program, None)
def setUp(self): """ Set up test data """ super(WritingProgramEnrollmentTest, self).setUp() catalog_org = CatalogOrganizationFactory.create( key=self.organization_key) program = ProgramFactory.create(uuid=self.program_uuid_x, authoring_organizations=[catalog_org]) organization = OrganizationFactory.create( short_name=self.organization_key) SAMLProviderConfigFactory.create(organization=organization) cache.set(PROGRAM_CACHE_KEY_TPL.format(uuid=self.program_uuid_x), program, None)
def setUpClass(cls): """ Set up test data """ super().setUpClass() catalog_org = CatalogOrganizationFactory.create( key=cls.organization_key) cls.program = ProgramFactory.create( uuid=cls.program_uuid, authoring_organizations=[catalog_org]) organization = OrganizationFactory.create( short_name=cls.organization_key) SAMLProviderConfigFactory.create(organization=organization) catalog_course_id_str = 'course-v1:edX+ToyX' course_run_id_str = f'{catalog_course_id_str}+Toy_Course' cls.course_id = CourseKey.from_string(course_run_id_str) CourseOverviewFactory(id=cls.course_id) course_run = CourseRunFactory(key=course_run_id_str) cls.course = CourseFactory(key=catalog_course_id_str, course_runs=[course_run]) cls.student_1 = UserFactory(username='******') cls.student_2 = UserFactory(username='******')
def setUp(self): super(SocialAuthEnrollmentCompletionSignalTest, self).setUp() RequestCache.clear_all_namespaces() catalog_org = CatalogOrganizationFactory.create(key=self.organization.short_name) self.program_uuid = self._create_catalog_program(catalog_org)['uuid']
def setUp(self): super(SocialAuthEnrollmentCompletionSignalTest, self).setUp() RequestCache.clear_all_namespaces() catalog_org = CatalogOrganizationFactory.create( key=self.organization.short_name) self.program_uuid = self._create_catalog_program(catalog_org)['uuid']
def setUp(self): super().setUp() RequestCache.clear_all_namespaces() catalog_org = CatalogOrganizationFactory.create( key=self.organization.short_name) self.program_uuid = self._create_catalog_program(catalog_org)['uuid']