Fix incorrect use of json.dumps

All optional parameters to json.dumps() are now keyword-only in Python 3.6.  Although this is the error that's flag, the tests use of json.dumps is actually incorrect: it should write the json.dumps with write()
This commit is contained in:
Vladimir Diaz 2017-09-22 11:04:47 -04:00
parent 36b1780f74
commit 64fb960c00
No known key found for this signature in database
GPG key ID: 5DEE9B97B0E2289A

View file

@ -266,7 +266,8 @@ def test_with_tuf_and_metadata_tampering(self):
tuf.formats.check_signable_object_format(metadata)
with open(metadata_path, 'wb') as file_object:
json.dumps(metadata, file_object, indent=1, sort_keys=True).encode('utf-8')
file_object.write(json.dumps(metadata, indent=1,
separators=(',', ': '), sort_keys=True).encode('utf-8'))
# Verify that the malicious 'targets.json' is not downloaded. Perform
# a refresh of top-level metadata to demonstrate that the malicious