summaryrefslogtreecommitdiff
path: root/tests/field_deconstruction/tests.py
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2014-08-03 14:02:21 +0200
committerBaptiste Mispelon <bmispelon@gmail.com>2014-08-03 14:02:21 +0200
commit74325339327e5b8a2480aee7f482bc71f73c71f9 (patch)
tree0d9c4f9ca41ebb97de2b43f38acceba23099a5c6 /tests/field_deconstruction/tests.py
parent72f1eb48df335c110f39d56f7978d95896a56bb8 (diff)
Added missing logic to TimeField.deconstruct().
If auto_now or auto_now_add was used then the serialized field in the migration contained unnecessary `editable` and `blank` arguments.
Diffstat (limited to 'tests/field_deconstruction/tests.py')
-rw-r--r--tests/field_deconstruction/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py
index be73f8b19e..c5f3f63999 100644
--- a/tests/field_deconstruction/tests.py
+++ b/tests/field_deconstruction/tests.py
@@ -336,6 +336,23 @@ class FieldDeconstructionTests(TestCase):
self.assertEqual(args, [])
self.assertEqual(kwargs, {})
+ def test_time_field(self):
+ field = models.TimeField()
+ name, path, args, kwargs = field.deconstruct()
+ self.assertEqual(path, "django.db.models.TimeField")
+ self.assertEqual(args, [])
+ self.assertEqual(kwargs, {})
+
+ field = models.TimeField(auto_now=True)
+ name, path, args, kwargs = field.deconstruct()
+ self.assertEqual(args, [])
+ self.assertEqual(kwargs, {'auto_now': True})
+
+ field = models.TimeField(auto_now_add=True)
+ name, path, args, kwargs = field.deconstruct()
+ self.assertEqual(args, [])
+ self.assertEqual(kwargs, {'auto_now_add': True})
+
def test_url_field(self):
field = models.URLField()
name, path, args, kwargs = field.deconstruct()