mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Added BaseDatabaseSchemaEditor._effective_default() to allow testing without a connection.
This commit is contained in:
parent
e62f6e0968
commit
9cac10eee4
2 changed files with 13 additions and 12 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue