From c466ef3b34962e5ca7259297b163b4ad88beeda4 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sat, 9 Sep 2017 20:38:52 -0400 Subject: [PATCH] Tested field deconstruction with DEFAULT_DB_TABLESPACE and db_tablespace. --- tests/field_deconstruction/tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py index 408fca158a..f1652e2c40 100644 --- a/tests/field_deconstruction/tests.py +++ b/tests/field_deconstruction/tests.py @@ -28,6 +28,27 @@ class FieldDeconstructionTests(SimpleTestCase): name, path, args, kwargs = field.deconstruct() self.assertEqual(name, "author") + def test_db_tablespace(self): + field = models.Field() + _, _, args, kwargs = field.deconstruct() + self.assertEqual(args, []) + self.assertEqual(kwargs, {}) + # With a DEFAULT_DB_TABLESPACE. + with self.settings(DEFAULT_DB_TABLESPACE='foo'): + _, _, args, kwargs = field.deconstruct() + self.assertEqual(args, []) + self.assertEqual(kwargs, {}) + # With a db_tablespace. + field = models.Field(db_tablespace='foo') + _, _, args, kwargs = field.deconstruct() + self.assertEqual(args, []) + self.assertEqual(kwargs, {'db_tablespace': 'foo'}) + # With a db_tablespace equal to DEFAULT_DB_TABLESPACE. + with self.settings(DEFAULT_DB_TABLESPACE='foo'): + _, _, args, kwargs = field.deconstruct() + self.assertEqual(args, []) + self.assertEqual(kwargs, {'db_tablespace': 'foo'}) + def test_auto_field(self): field = models.AutoField(primary_key=True) field.set_attributes_from_name("id")