Skip to content

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

Description

@tseaver

From this CI failure:

______________TestClient.test_create_bucket_with_string_conflict______________self=<tests.unit.test_client.TestClienttestMethod=test_create_bucket_with_string_conflict>deftest_create_bucket_with_string_conflict(self):
fromgoogle.cloud.exceptionsimportConflictproject="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=httpwithself.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: inassert_called_once_withreturnself.assert_called_with(*args, **kwargs)
.nox/unit-3-5/lib/python3.5/site-packages/mock/mock.py:944: inassert_called_withsix.raise_from(AssertionError(_error_message(cause)), cause)
__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value=None, from_value=None> ???
EExpected: request(data=<ANY>, headers=<ANY>, method='POST', url='https://storage.googleapis.com/storage/v1/b?project=OTHER_PROJECT&userProject=USER_PROJECT')
EActual: 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')

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.testingtype: processA process-related concern. May include testing, release, or the like.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions