diff options
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_hstore.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_hstore.py b/tests/postgres_tests/test_hstore.py index 8ebd757098..b927d8e19f 100644 --- a/tests/postgres_tests/test_hstore.py +++ b/tests/postgres_tests/test_hstore.py @@ -208,6 +208,13 @@ class TestFormField(PostgreSQLTestCase): self.assertEqual(cm.exception.messages[0], 'Could not load JSON data.') self.assertEqual(cm.exception.code, 'invalid_json') + def test_non_dict_json(self): + field = forms.HStoreField() + msg = 'Input must be a JSON dictionary.' + with self.assertRaisesMessage(exceptions.ValidationError, msg) as cm: + field.clean('["a", "b", 1]') + self.assertEqual(cm.exception.code, 'invalid_format') + def test_not_string_values(self): field = forms.HStoreField() value = field.clean('{"a": 1}') |
