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

Storage: query string order dependency in 'test_create_bucket_with_string_confict' unit test. #9714

Closed
tseaver opened this issue Nov 11, 2019 · 0 comments · Fixed by #9728
Closed
Assignees
Labels
api: storage Issues related to the Cloud Storage API. testing type: process A process-related concern. May include testing, release, or the like.

Comments

@tseaver
Copy link
Contributor

tseaver commented Nov 11, 2019

From this CI failure:

______________ TestClient.test_create_bucket_with_string_conflict ______________

self = <tests.unit.test_client.TestClient testMethod=test_create_bucket_with_string_conflict>

    def test_create_bucket_with_string_conflict(self):
        from google.cloud.exceptions import Conflict

        project = "PROJECT"
        user_project = "USER_PROJECT"
        other_project = "OTHER_PROJECT"
        credentials = _make_credentials()
        client = self._make_one(project=project, credentials=credentials)

        bucket_name = "bucket-name"
        URI = "/".join(
            [
                client._connection.API_BASE_URL,
                "storage",
                client._connection.API_VERSION,
                "b?project=%s&userProject=%s" % (other_project, user_project),
            ]
        )
        data = {"error": {"message": "Conflict"}}
        json_expected = {"name": bucket_name}
        http = _make_requests_session(
            [_make_json_response(data, status=http_client.CONFLICT)]
        )
        client._http_internal = http

        with self.assertRaises(Conflict):
            client.create_bucket(
                bucket_name, project=other_project, user_project=user_project
            )

        http.request.assert_called_once_with(
>           method="POST", url=URI, data=mock.ANY, headers=mock.ANY
        )

tests/unit/test_client.py:551:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.nox/unit-3-5/lib/python3.5/site-packages/mock/mock.py:957: in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
.nox/unit-3-5/lib/python3.5/site-packages/mock/mock.py:944: in assert_called_with
    six.raise_from(AssertionError(_error_message(cause)), cause)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

value = None, from_value = None

>   ???
E   Expected: request(data=<ANY>, headers=<ANY>, method='POST', url='https://storage.googleapis.com/storage/v1/b?project=OTHER_PROJECT&userProject=USER_PROJECT')
E   Actual: request(data='{"name": "bucket-name"}', headers={'Content-Type': 'application/json', 'X-Goog-API-Client': 'gcloud-python/1.22.0  gl-python/3.5.3 gax/1.14.3 gccl/1.22.0', 'User-Agent': 'gcloud-python/1.22.0  gl-python/3.5.3 gax/1.14.3 gccl/1.22.0', 'Accept-Encoding': 'gzip'}, method='POST', url='https://storage.googleapis.com/storage/v1/b?userProject=USER_PROJECT&project=OTHER_PROJECT')
@tseaver tseaver added api: storage Issues related to the Cloud Storage API. testing type: process A process-related concern. May include testing, release, or the like. labels Nov 11, 2019
@tseaver tseaver self-assigned this Nov 11, 2019
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. testing type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant