You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E AssertionError: expected call not found.
E Expected: upload_from_file(<ANY>, rewind=True, retry=<google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, size=11, predefined_acl=None, content_type='application/javascript')
E Actual: upload_from_file(<ContentFile: Raw content>, rewind=True, retry=<google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, size=11, predefined_acl=None, content_type='text/javascript')
Full log:
_____________ GoogleCloudGzipClientTests.test_storage_save_gzipped _____________
self = <tests.test_gcloud.GoogleCloudGzipClientTests testMethod=test_storage_save_gzipped>
args = (<MagicMock name='_do_upload' id='140737256238128'>,)
name = 'test_storage_save.js.gz', content = <ContentFile: Raw content>
blob = <Blob: None, x, None>
@mock.patch("google.cloud.storage.blob.Blob._do_upload")
def test_storage_save_gzipped(self, *args):
"""
Test saving a gzipped file
"""
name = "test_storage_save.js.gz"
content = ContentFile("I am gzip'd", name=name)
blob = Blob("x", None)
blob.upload_from_file = mock.MagicMock(side_effect=blob.upload_from_file)
patcher = mock.patch("google.cloud.storage.Bucket.get_blob", return_value=blob)
try:
patcher.start()
self.storage.save(name, content)
obj = self.storage._bucket.get_blob()
> obj.upload_from_file.assert_called_with(
mock.ANY,
rewind=True,
retry=DEFAULT_RETRY,
size=11,
predefined_acl=None,
content_type="application/javascript",
)
tests/test_gcloud.py:533:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MagicMock name='Client().bucket().get_blob().upload_from_file' id='140737256396064'>
args = (<ANY>,)
kwargs = {'content_type': 'application/javascript', 'predefined_acl': None, 'retry': <google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, 'rewind': True, ...}
expected = call(<ANY>, rewind=True, retry=<google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, size=11, predefined_acl=None, content_type='application/javascript')
actual = call(<ContentFile: Raw content>, rewind=True, retry=<google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, size=11, predefined_acl=None, content_type='text/javascript')
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7ffff2328d60>
cause = None
def assert_called_with(self, /, *args, **kwargs):
"""assert that the last call was made with the specified arguments.
Raises an AssertionError if the args and keyword args passed in are
different to the last call to the mock."""
if self.call_args is None:
expected = self._format_mock_call_signature(args, kwargs)
actual = 'not called.'
error_message = ('expected call not found.\nExpected: %s\n Actual: %s'
% (expected, actual))
raise AssertionError(error_message)
def _error_message():
msg = self._format_mock_failure_message(args, kwargs)
return msg
expected = self._call_matcher(_Call((args, kwargs), two=True))
actual = self._call_matcher(self.call_args)
if actual != expected:
cause = expected if isinstance(expected, Exception) else None
> raise AssertionError(_error_message()) from cause
E AssertionError: expected call not found.
E Expected: upload_from_file(<ANY>, rewind=True, retry=<google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, size=11, predefined_acl=None, content_type='application/javascript')
E Actual: upload_from_file(<ContentFile: Raw content>, rewind=True, retry=<google.api_core.retry.retry_unary.Retry object at 0x7ffff399e120>, size=11, predefined_acl=None, content_type='text/javascript')
/nix/store/wfbjq35kxs6x83c3ncpfxdyl5gbhdx4h-python3-3.12.6/lib/python3.12/unittest/mock.py:947: AssertionError
Could be missing support for the latest version of Mock
The text was updated successfully, but these errors were encountered:
Actual AssertionError in content_type
Full log:
Could be missing support for the latest version of Mock
The text was updated successfully, but these errors were encountered: