{"id":20068561,"url":"https://github.com/tofull/gcs_simulator","last_synced_at":"2025-08-08T23:12:27.913Z","repository":{"id":220589277,"uuid":"320451995","full_name":"Tofull/gcs_simulator","owner":"Tofull","description":"Simulator of Google Cloud Storage python API using local folder as \"bucket\".","archived":false,"fork":false,"pushed_at":"2020-12-11T17:07:41.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-27T19:47:22.680Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tofull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-12-11T03:04:11.000Z","updated_at":"2020-12-11T18:12:32.000Z","dependencies_parsed_at":"2024-02-02T23:26:39.400Z","dependency_job_id":"56912c56-3276-447c-9ef2-a4b6dc4716d4","html_url":"https://github.com/Tofull/gcs_simulator","commit_stats":null,"previous_names":["tofull/gcs_simulator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Tofull/gcs_simulator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Fgcs_simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Fgcs_simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Fgcs_simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Fgcs_simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tofull","download_url":"https://codeload.github.com/Tofull/gcs_simulator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tofull%2Fgcs_simulator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269502567,"owners_count":24427790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-08T02:00:09.200Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T14:07:34.680Z","updated_at":"2025-08-08T23:12:27.850Z","avatar_url":"https://github.com/Tofull.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Cloud Storage simulator\n\nA simple simulator which allows to use a local folder as \"bucket\" and try to mimic the `google.cloud.storage` API.\n\nImplemented behaviours:\n- `Client`\n- `Bucket`\n  - `get_blob`\n  - `blob`\n- `Blob`\n  - `download_to_filename`\n  - `upload_from_filename`\n  - `delete`\n\n## Example\n\nHere is a quick overview how to use this simulator.\n\n```python\nfrom unittest import mock\nfrom gcs_simulator.storage import MockClient\n\n# define a fake client which will replace the google.cloud.storage.Client object.\nclass FakeClient(MockClient):\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self.set_local_root_folder_used_for_simulation(\"local_folder_used_by_simulator\")\n\n\n# ...\n# and later, use the fake client as follow:\n\nfrom google.cloud import storage\n\n@mock.patch(\"google.cloud.storage.Client\", FakeClient)\ndef any_function_which_uses_storage_API():\n    # this function will use the mocked Client\n    storage_client = storage.Client()\n\n    # retrieve blob\n    any_blob = storage_client.bucket(\"any_bucket\").get_blob(\"any_stored_blob\")\n    any_blob.download_to_filename(\"any_local_filename\")\n\n    # upload blob\n    another_blob = storage_client.bucket(\"another_bucket\").blob(\"another_blob\")\n    another_blob.upload_from_filename(\"any_local_filename\")\n\n    # manage blob\n    any_blob.delete()\n```\n\nSee [example folder](./example) to see how to use this simulator with background cloud functions.\n\n# Note for developers\n\n```sh\nconda env create --file environment.yml\nconda activate gcs_simulator_dev_environment\npre-commit install\n\npython -m pytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftofull%2Fgcs_simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftofull%2Fgcs_simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftofull%2Fgcs_simulator/lists"}