def test_create_container(self):
    service = Service('foo', client=self.mock_client, build={'context': '.'})
    self.mock_client.inspect_image.side_effect = [NoSuchImageError, {'Id': 'abc123'}]
    self.mock_client.build.return_value = ['{"stream": "Successfully built abcd"}']
    with mock.patch('compose.service.log', autospec=True) as mock_log:
        service.create_container()
        assert mock_log.warn.called
        (_, args, _) = mock_log.warn.mock_calls[0]
        assert ('was built because it did not already exist' in args[0])
    assert (self.mock_client.build.call_count == 1)
    (self.mock_client.build.call_args[1]['tag'] == 'default_foo')
def test_create_container(self):
    service = Service('foo', client=self.mock_client, build={'context': '.'})
    self.mock_client.inspect_image.side_effect = [NoSuchImageError, {'Id': 'abc123'}]
    self.mock_client.build.return_value = ['{"stream": "Successfully built abcd"}']
    with mock.patch('compose.service.log', autospec=True) as mock_log:
        service.create_container()
        assert mock_log.warn.called
        (_, args, _) = mock_log.warn.mock_calls[0]
        assert ('was built because it did not already exist' in args[0])
    assert (self.mock_client.build.call_count == 1)
    (self.mock_client.build.call_args[1]['tag'] == 'default_foo')