summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-11-17 18:50:26 -0500
committerTim Graham <timograham@gmail.com>2018-11-17 19:27:53 -0500
commit9cac10eee49eae3bbf7bd133ba0ae931b275324c (patch)
treeff643109e069cae9e4583b334fe6c29191150ef2 /tests
parente62f6e0968eb19a44198211b5398c5738db454c5 (diff)
Added BaseDatabaseSchemaEditor._effective_default() to allow testing without a connection.
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/base/test_schema.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/backends/base/test_schema.py b/tests/backends/base/test_schema.py
index 9f740d9326..2ecad098a6 100644
--- a/tests/backends/base/test_schema.py
+++ b/tests/backends/base/test_schema.py
@@ -1,8 +1,9 @@
-from django.db import connection, models
-from django.test import TestCase
+from django.db import models
+from django.db.backends.base.schema import BaseDatabaseSchemaEditor
+from django.test import SimpleTestCase
-class SchemaEditorTests(TestCase):
+class SchemaEditorTests(SimpleTestCase):
def test_effective_default_callable(self):
"""SchemaEditor.effective_default() shouldn't call callable defaults."""
@@ -14,9 +15,5 @@ class SchemaEditorTests(TestCase):
def _get_default(self):
return self.default
- def get_db_prep_save(self, default, connection):
- return default
-
field = MyCharField(max_length=1, default=MyStr)
- with connection.schema_editor() as editor:
- self.assertEqual(editor.effective_default(field), MyStr)
+ self.assertEqual(BaseDatabaseSchemaEditor._effective_default(field), MyStr)