summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/introspection/models.py5
-rw-r--r--tests/regressiontests/introspection/tests.py9
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/regressiontests/introspection/models.py b/tests/regressiontests/introspection/models.py
index 3b8383e601..02a8d71549 100644
--- a/tests/regressiontests/introspection/models.py
+++ b/tests/regressiontests/introspection/models.py
@@ -7,6 +7,9 @@ class Reporter(models.Model):
email = models.EmailField()
facebook_user_id = models.BigIntegerField(null=True)
+ class Meta:
+ unique_together = ('first_name', 'last_name')
+
def __unicode__(self):
return u"%s %s" % (self.first_name, self.last_name)
@@ -19,4 +22,4 @@ class Article(models.Model):
return self.headline
class Meta:
- ordering = ('headline',) \ No newline at end of file
+ ordering = ('headline',)
diff --git a/tests/regressiontests/introspection/tests.py b/tests/regressiontests/introspection/tests.py
index b425b6401d..ca58f04494 100644
--- a/tests/regressiontests/introspection/tests.py
+++ b/tests/regressiontests/introspection/tests.py
@@ -137,6 +137,15 @@ class IntrospectionTests(TestCase):
indexes = connection.introspection.get_indexes(cursor, Article._meta.db_table)
self.assertEqual(indexes['reporter_id'], {'unique': False, 'primary_key': False})
+ def test_get_indexes_multicol(self):
+ """
+ Test that multicolumn indexes are not included in the introspection
+ results.
+ """
+ cursor = connection.cursor()
+ indexes = connection.introspection.get_indexes(cursor, Reporter._meta.db_table)
+ self.assertNotIn('first_name', indexes)
+ self.assertIn('id', indexes)
def datatype(dbtype, description):
"""Helper to convert a data type into a string."""