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)
def test_service_controller(self, MockController): provider = driver.CDNProvider(self.conf) self.assertNotEqual(provider.service_controller, None)
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)
def test_is_alive(self): provider = driver.CDNProvider(self.conf) self.assertEqual(provider.is_alive(), True)
def test_init(self, mock_connect): provider = driver.CDNProvider(self.conf) mock_connect.assert_called_once_with( provider._conf['drivers:provider:fastly'].apikey)
def test_certificate_controller(self): provider = driver.CDNProvider(self.conf) self.assertIsNotNone(provider.certificate_controller)
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)