diff options
| author | Curtis Maloney <curtis@tinbrain.net> | 2015-08-04 10:47:58 +1000 |
|---|---|---|
| committer | Markus Holtermann <info@markusholtermann.eu> | 2015-08-04 19:15:22 +1000 |
| commit | 9f73009e98c51986a50cc45844b8bca72673e955 (patch) | |
| tree | f6f71e5100f4f26b00979c3dbad3839117f6fb53 /tests/postgres_tests/test_hstore.py | |
| parent | 770449e24b3b0fa60d870bc3404961ddca754c3b (diff) | |
Fixed #25215 -- Solved reference to forms.HStoreField in declaration of HStoreField
Correct test which was using the model field in a test form.
Diffstat (limited to 'tests/postgres_tests/test_hstore.py')
| -rw-r--r-- | tests/postgres_tests/test_hstore.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/postgres_tests/test_hstore.py b/tests/postgres_tests/test_hstore.py index 34229bb15c..81ee02dafa 100644 --- a/tests/postgres_tests/test_hstore.py +++ b/tests/postgres_tests/test_hstore.py @@ -191,12 +191,21 @@ class TestFormField(PostgreSQLTestCase): form_field = model_field.formfield() self.assertIsInstance(form_field, forms.HStoreField) - def test_empty_field_has_not_changed(self): + def test_field_has_changed(self): class HStoreFormTest(Form): - f1 = HStoreField() + f1 = forms.HStoreField() form_w_hstore = HStoreFormTest() self.assertFalse(form_w_hstore.has_changed()) + form_w_hstore = HStoreFormTest({'f1': '{"a": 1}'}) + self.assertTrue(form_w_hstore.has_changed()) + + form_w_hstore = HStoreFormTest({'f1': '{"a": 1}'}, initial={'f1': '{"a": 1}'}) + self.assertFalse(form_w_hstore.has_changed()) + + form_w_hstore = HStoreFormTest({'f1': '{"a": 2}'}, initial={'f1': '{"a": 1}'}) + self.assertTrue(form_w_hstore.has_changed()) + class TestValidator(PostgreSQLTestCase): |
