def test_load_containers(self, mock_container_ship_healthy, mock_container_ship_load_service_containers): mock_container_ship_healthy.return_value = True mock_service = mock.Mock(spec=Service) self.mock_urlparse.return_value.scheme = 'http' container_ship = ContainerShip(address='http://127.0.0.1:2376', **{}) container_ship.load_containers(service=mock_service, configs={}, use_cache=False) self.assertIsInstance(container_ship, ContainerShip)
def test_load_containers_failure(self, mock_container_ship_healthy): self.mock_urlparse.return_value.scheme = 'http' with self.assertRaises(TypeError): container_ship = ContainerShip(address='127.0.0.1:2376', **{}) container_ship.load_containers(service=None, configs={}, use_cache=False) mock_container_ship_healthy.return_value = False with self.assertRaises(Exception): container_ship = ContainerShip(address='http://127.0.0.1:2376', **{}) container_ship.load_containers(service=self.mock_service, configs={}, use_cache=False)
def test_load_containers(self, mock_container_ship_healthy, mock_container_ship_load_service_containers): mock_container_ship_healthy.return_value = True self.mock_urlparse.return_value.scheme = 'http' container_ship = ContainerShip(address='http://127.0.0.1:2376', **{}) container_ship.load_containers(service=self.mock_service, configs={}, use_cache=False) self.assertIsInstance(container_ship, ContainerShip)