def test_valid(self): names = list_secret_names('{"version": "1.0", "secrets": ["one", "two"]}') self.assertEqual(names, ["one", "two"])
def test_invalid_version(self): with self.assertRaisesRegex(ValueError, "incompatible protocol version 2.0"): list_secret_names('{"version": "2.0"}')
def test_not_list(self): with self.assertRaisesRegex(ValueError, "should be an array"): list_secret_names('{"version": "1.0", "secrets": "one"}')
def test_invalid_output(self): with self.assertRaisesRegex( ValueError, r"Expecting value: line 1 column 1 \(char 0\)" ): list_secret_names("")