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")