Skip to content

Commit 6720b35

Browse files
committed
Defend against hash randomization non-determanism.
Also, de-lint long URL comments.
1 parent 09c1d14 commit 6720b35

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

gcloud/bigquery/dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ def _parse_access_grants(self, access):
292292
role = grant.pop('role')
293293
# Hypothetical case: we don't know that the back-end will ever
294294
# return such structures, but they are logical. See:
295-
#https://github.com/GoogleCloudPlatform/gcloud-python/pull/1046#discussion_r36687769
296-
for entity_type, entity_id in grant.items():
295+
# https://github.com/GoogleCloudPlatform/gcloud-python/pull/1046#discussion_r36687769
296+
for entity_type, entity_id in sorted(grant.items()):
297297
result.append(
298298
AccessGrant(role, entity_type, entity_id))
299299
return result

gcloud/bigquery/test_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _verifyAccessGrants(self, access_grants, resource):
7777
r_grants = []
7878
for r_grant in resource['access']:
7979
role = r_grant.pop('role')
80-
for entity_type, entity_id in r_grant.items():
80+
for entity_type, entity_id in sorted(r_grant.items()):
8181
r_grants.append({'role': role,
8282
'entity_type': entity_type,
8383
'entity_id': entity_id})
@@ -266,7 +266,7 @@ def test__parse_access_grants_w_unknown_entity_type(self):
266266
def test__parse_access_grants_w_multiple_entity_types(self):
267267
# Hypothetical case: we don't know that the back-end will ever
268268
# return such structures, but they are logical. See:
269-
#https://github.com/GoogleCloudPlatform/gcloud-python/pull/1046#discussion_r36687769
269+
# https://github.com/GoogleCloudPlatform/gcloud-python/pull/1046#discussion_r36687769
270270
USER_EMAIL = 'phred@example.com'
271271
OTHER_EMAIL = 'bharney@example.com'
272272
GROUP_EMAIL = 'group-name@lists.example.com'

0 commit comments

Comments
 (0)