def test_get_container(self, mock_container_class): container_dict = dict(Name="default_foo_2") self.mock_client.containers.return_value = [container_dict] service = Service("foo", client=self.mock_client) container = service.get_container(number=2) self.assertEqual(container, mock_container_class.from_ps.return_value) mock_container_class.from_ps.assert_called_once_with(self.mock_client, container_dict)
def test_get_container(self, mock_container_class): container_dict = dict(Name='default_foo_2') self.mock_client.containers.return_value = [container_dict] service = Service('foo', client=self.mock_client) container = service.get_container(number=2) self.assertEqual(container, mock_container_class.from_ps.return_value) mock_container_class.from_ps.assert_called_once_with( self.mock_client, container_dict)
def test_get_container(self, mock_container_class): mock_client = mock.create_autospec(docker.Client) container_dict = dict(Name='default_foo_2') mock_client.containers.return_value = [container_dict] service = Service('foo', client=mock_client) container = service.get_container(number=2) self.assertEqual(container, mock_container_class.from_ps.return_value) mock_container_class.from_ps.assert_called_once_with( mock_client, container_dict)