Skip to content

Commit

Permalink
Avoid hash-order dependencies in stringified JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Feb 19, 2015
1 parent 87c08b6 commit 766d0fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gcloud/storage/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def test_finish_empty(self):
self.assertTrue(connection.http is http)

def test_finish_nonempty(self):
import json
URL = 'http://api.example.com/other_api'
expected = _Response()
expected['Content-Type'] = 'multipart/mixed; boundary="DEADBEEF="'
Expand Down Expand Up @@ -208,7 +209,7 @@ def test_finish_nonempty(self):
self.assertEqual(lines[5], 'Content-Length: 20')
self.assertEqual(lines[6], 'Content-Type: application/json')
self.assertEqual(lines[7], '')
self.assertEqual(lines[8], '{"foo": 1, "bar": 2}')
self.assertEqual(json.loads(lines[8]), {'foo': 1, 'bar': 2})

lines = chunks[1].splitlines()
# blank + 2 headers + blank + request + 2 headers + blank + body
Expand All @@ -221,7 +222,7 @@ def test_finish_nonempty(self):
self.assertEqual(lines[5], 'Content-Length: 10')
self.assertEqual(lines[6], 'Content-Type: application/json')
self.assertEqual(lines[7], '')
self.assertEqual(lines[8], '{"bar": 3}')
self.assertEqual(json.loads(lines[8]), {'bar': 3})

lines = chunks[2].splitlines()
# blank + 2 headers + blank + request + 2 headers + blank + body
Expand Down

0 comments on commit 766d0fb

Please sign in to comment.