def setUpClass(cls): super(TestAlgoliaProxyWithEdxPartner, cls).setUpClass() Partner.objects.all().delete() Site.objects.all().delete() cls.site = SiteFactory(id=settings.SITE_ID, domain=TEST_DOMAIN) cls.edxPartner = PartnerFactory(site=cls.site) cls.edxPartner.name = 'edX'
def site(db): # pylint: disable=unused-argument skip_if_no_django() from django.conf import settings Site.objects.all().delete() return SiteFactory(id=settings.SITE_ID, domain=TEST_DOMAIN)
def test_update_partner(self): """ Verify the command updates an existing Partner """ self._create_partner() site = SiteFactory() self.site_domain = 'some-other-test.example.org' self.partner_name = 'Updated Partner' self.courses_api_url = 'https://courses.updated.org/api/v1/courses/' self.lms_coursemode_api_url = 'http://courses.updated.org/api/course_modes/v1/' self.ecommerce_api_url = 'https://ecommerce.updated.org/api/v1/courses/' self.organizations_api_url = 'https://orgs.updated.org/api/v1/organizations/' self.programs_api_url = 'https://programs.updated.org/api/v1/programs/' self.lms_url = 'http://courses.updated.org/' self.studio_url = 'http://studio.updated.org/' self.publisher_url = 'http://publisher.updated.org/' self.marketing_site_api_url = 'https://www.updated.org/api/v1/courses/' self.marketing_site_url_root = 'https://www.updated.org/' self.marketing_site_api_username = '******' self.marketing_site_api_password = '******' self._call_command( site_id=site.id, site_domain=self.site_domain, partner_code=self.partner_code, partner_name=self.partner_name, courses_api_url=self.courses_api_url, lms_coursemode_api_url=self.lms_coursemode_api_url, ecommerce_api_url=self.ecommerce_api_url, organizations_api_url=self.organizations_api_url, programs_api_url=self.programs_api_url, lms_url=self.lms_url, studio_url=self.studio_url, publisher_url=self.publisher_url, marketing_site_api_url=self.marketing_site_api_url, marketing_site_url_root=self.marketing_site_url_root, marketing_site_api_username=self.marketing_site_api_username, marketing_site_api_password=self.marketing_site_api_password, ) partner = Partner.objects.get(short_code=self.partner_code) self._check_partner(partner) site.refresh_from_db() self.assertEqual(site.domain, self.site_domain) self.assertEqual(partner.site, site)
def setUpClass(cls): super().setUpClass() Site.objects.all().delete() cls.site = SiteFactory(id=settings.SITE_ID, domain=TEST_DOMAIN) cls.partner = PartnerFactory(site=cls.site) cls.request = RequestFactory(SERVER_NAME=cls.site.domain).get('') cls.request.site = cls.site
def setUp(self): super(CourseStateTests, self).setUp() self.site = SiteFactory() self.partner = PartnerFactory(site=self.site) self.course = self.course_state.course self.course.image = make_image_file('test_banner.jpg') self.course.save() self.course.organizations.add(factories.OrganizationExtensionFactory().organization)
def test_list_include_all_partners(self): """ Verify the endpoint returns a list of all course runs for all partners. """ site1 = SiteFactory() partner1 = PartnerFactory(site=site1) site2 = SiteFactory() partner2 = PartnerFactory(site=site2) CourseRunFactory(course__partner=partner1) CourseRunFactory(course__partner=partner2) url = reverse('api:v1:course_run-list') url += '?include_all_partners=1' with self.assertNumQueries(17): response = self.client.get(url) assert response.status_code == 200 self.assertListEqual( response.data['results'], self.serialize_course_run(CourseRun.objects.all().order_by( Lower('key')), many=True))
def setUp(self): super(CourseRunStateTests, self).setUp() language_tag = LanguageTag(code='te-st', name='Test Language') language_tag.save() self.site = SiteFactory() self.partner = PartnerFactory(site=self.site) self.course_run.transcript_languages.add(language_tag) self.course_run.language = language_tag self.course_run.is_micromasters = True self.course_run.micromasters_name = 'test' self.course_run.lms_course_id = 'course-v1:edX+DemoX+Demo_Course' self.course_run.save() self.course.course_state.name = CourseStateChoices.Approved self.course.save() self.course_run.staff.add(PersonFactory()) self.course_run_state.preview_accepted = False self.course_run_state.save() self.assertTrue(self.course_run_state.can_send_for_review())