Пример #1
0
    def test_is_alive(self, mock_get):
        response_object = util.dict2obj(
            {'content': '', 'status_code': 200})
        mock_get.return_value = response_object

        provider = driver.CDNProvider(self.conf)
        self.assertEqual(provider.is_alive(), True)
Пример #2
0
 def test_service_controller(self, MockController):
     provider = driver.CDNProvider(self.conf)
     self.assertNotEqual(provider.service_controller, None)
Пример #3
0
 def test_get_client(self, MockConnection, mock_connect):
     mock_connect.return_value = MockConnection(None, None)
     provider = driver.CDNProvider(self.conf)
     client = provider.client()
     self.assertNotEqual(client, None)
Пример #4
0
 def test_is_alive(self):
     provider = driver.CDNProvider(self.conf)
     self.assertEqual(provider.is_alive(), True)
Пример #5
0
 def test_init(self, mock_connect):
     provider = driver.CDNProvider(self.conf)
     mock_connect.assert_called_once_with(
         provider._conf['drivers:provider:fastly'].apikey)
Пример #6
0
 def test_certificate_controller(self):
     provider = driver.CDNProvider(self.conf)
     self.assertIsNotNone(provider.certificate_controller)
Пример #7
0
 def test_not_available(self, mock_get):
     response_object = util.dict2obj(
         {'content': 'Not available', 'status_code': 404})
     mock_get.return_value = response_object
     provider = driver.CDNProvider(self.conf)
     self.assertEqual(provider.is_alive(), False)