def test_ensure_image_exists_no_build_but_needs_build(self):
    service = Service('foo', client=self.mock_client, build={'context': '.'})
    self.mock_client.inspect_image.side_effect = NoSuchImageError
    with pytest.raises(NeedsBuildError):
        service.ensure_image_exists(do_build=BuildAction.skip)
def test_ensure_image_exists_no_build_but_needs_build(self):
    service = Service('foo', client=self.mock_client, build={'context': '.'})
    self.mock_client.inspect_image.side_effect = NoSuchImageError
    with pytest.raises(NeedsBuildError):
        service.ensure_image_exists(do_build=BuildAction.skip)