Avoid using 'foo' as invalid JSON test data

Downstream test environments appear to have a file called 'foo' either
created out-of-band, or created by tests executed in a
non-deterministic order.

This changes the test data to very invalid json which is unlikely to
be a filename, ensuring the expected codepath is tested.

Change-Id: I88ed81337c6e2d724b3cf4ddf90e0d60fa052d1c
This commit is contained in:
Steve Baker 2022-03-01 13:42:54 +13:00
parent 4126936c4b
commit 59df415bbf

View File

@ -377,7 +377,7 @@ class HandleJsonFileTest(test_utils.BaseTestCase):
self.assertEqual(json.loads(cleansteps), steps)
def test_handle_json_or_file_arg_bad_json(self):
cleansteps = 'foo'
cleansteps = '{foo invalid: json{'
self.assertRaisesRegex(exc.InvalidAttribute,
'is not a file and cannot be parsed as JSON',
utils.handle_json_or_file_arg, cleansteps)