summaryrefslogtreecommitdiff
path: root/tests/backends
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2016-09-08 13:33:36 -0700
committerTim Graham <timograham@gmail.com>2016-09-08 16:33:36 -0400
commit7ca3b391b611eb710c4c1d613e2f672591097a00 (patch)
tree92dad21e80ae5d20fd35645395dac95d4bc37041 /tests/backends
parent0bbab97c289ebcfd5676d4c84686c5549e650f8d (diff)
Fixed #27170 -- Added DatabaseWrapper class attributes to ease subclassing.
Diffstat (limited to 'tests/backends')
-rw-r--r--tests/backends/tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 4851995149..106fd7f856 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -32,6 +32,31 @@ from django.utils.six.moves import range
from . import models
+class DatabaseWrapperTests(SimpleTestCase):
+
+ def test_initialization_class_attributes(self):
+ """
+ The "initialization" class attributes like client_class and
+ creation_class should be set on the class and reflected in the
+ corresponding instance attributes of the instantiated backend.
+ """
+ conn = connections[DEFAULT_DB_ALIAS]
+ conn_class = type(conn)
+ attr_names = [
+ ('client_class', 'client'),
+ ('creation_class', 'creation'),
+ ('features_class', 'features'),
+ ('introspection_class', 'introspection'),
+ ('ops_class', 'ops'),
+ ('validation_class', 'validation'),
+ ]
+ for class_attr_name, instance_attr_name in attr_names:
+ class_attr_value = getattr(conn_class, class_attr_name)
+ self.assertIsNotNone(class_attr_value)
+ instance_attr_value = getattr(conn, instance_attr_name)
+ self.assertIsInstance(instance_attr_value, class_attr_value)
+
+
class DummyBackendTest(SimpleTestCase):
def test_no_databases(self):