Esempio n. 1
0
 def setUp(self):
     super(ApiAccessRequestSignalTests, self).setUp()
     self.user = UserFactory()
     self.api_access_request = ApiAccessRequest(user=self.user,
                                                site=SiteFactory())
     self.send_new_pending_email_function = 'openedx.core.djangoapps.api_admin.models._send_new_pending_email'
     self.send_decision_email_function = 'openedx.core.djangoapps.api_admin.models._send_decision_email'
Esempio n. 2
0
 def setUp(self):
     """
     Create CommerceConfiguration object
     """
     super(CommerceConfigurationModelTests, self).setUp()
     self.site = SiteFactory()
     self.order_number = "TEST_ORDER_NUMBER"
Esempio n. 3
0
    def test_set_config_by_domain(self):
        """
        Tests microsite.set_config_by_domain works as expected.
        """
        microsite.clear()
        # if microsite config does not exist
        microsite.set_by_domain('unknown')
        self.assertIsNone(microsite.get_value('platform_name'))

        # if no microsite exists
        Microsite.objects.all().delete()
        microsite.clear()
        microsite.set_by_domain('unknown')
        self.assertIsNone(microsite.get_value('platform_name'))

        # if microsite site has no organization it should raise exception
        new_microsite = MicrositeFactory.create(key="test_microsite2")
        new_microsite.site = SiteFactory.create(domain='test.microsite2.com')
        # This would update microsite so we test MicrositeHistory has old microsite
        new_microsite.save()
        self.assertEqual(MicrositeHistory.objects.all().count(), 2)
        with self.assertRaises(Exception):
            microsite.set_by_domain('test.microsite2.com')
Esempio n. 4
0
    def test_set_config_by_domain(self):
        """
        Tests microsite.set_config_by_domain works as expected.
        """
        microsite.clear()
        # if microsite config does not exist
        microsite.set_by_domain('unknown')
        self.assertIsNone(microsite.get_value('platform_name'))

        # if no microsite exists
        Microsite.objects.all().delete()
        microsite.clear()
        microsite.set_by_domain('unknown')
        self.assertIsNone(microsite.get_value('platform_name'))

        # if microsite site has no organization it should raise exception
        new_microsite = MicrositeFactory.create(key="test_microsite2")
        new_microsite.site = SiteFactory.create(domain='test.microsite2.com')
        # This would update microsite so we test MicrositeHistory has old microsite
        new_microsite.save()
        self.assertEqual(MicrositeHistory.objects.all().count(), 2)
        with self.assertRaises(Exception):
            microsite.set_by_domain('test.microsite2.com')