Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mocking google cloud storage #5816

Closed
skhaz opened this issue Aug 17, 2018 · 1 comment
Closed

Mocking google cloud storage #5816

skhaz opened this issue Aug 17, 2018 · 1 comment
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.

Comments

@skhaz
Copy link

skhaz commented Aug 17, 2018

Hi,

I'm trying to test a piece of code that uses the google cloud storage, but there's no emulators for that neither something like to the moto. How can I mock these component?

Thanks.

@JustinBeckwith JustinBeckwith added the triage me I really want to be triaged. label Aug 18, 2018
@tseaver tseaver added type: question Request for information or clarification. Not an issue. api: storage Issues related to the Cloud Storage API. and removed triage me I really want to be triaged. labels Aug 20, 2018
@tseaver
Copy link
Contributor

tseaver commented Aug 20, 2018

As you note, there is no emulator for the GCS service (see #4897, #4840): constructing one is not within scope for the google-cloud-storage library project.

"Mocking" is perhaps ambiguous -- to me it implies more of a unit testing context, e.g.:

from google.cloud import storage
import mock

def test_code_using_gcs():
    client = mock.create_autospec(storage.Client)
    # now set 'return_value', etc. on client's methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants