summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnssi Kääriäinen <anssi.kaariainen@thl.fi>2012-04-30 04:53:22 -0700
committerAnssi Kääriäinen <anssi.kaariainen@thl.fi>2012-04-30 04:53:22 -0700
commitc09f6ff0a58d016eeb7536f1df1fa956f94f671c (patch)
tree296fb370abf2407e008d0849f013dac4e457e3bc /tests
parenteba4197c71d152b30ddfe48e9dfbbd88f1ffd104 (diff)
parenta18e43c5bb8cb7c82c84ca1b42d847a62ac9f077 (diff)
Merge pull request #25 from akaariai/ticket_15933_alt
Made get_indexes() consistent across backends.
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."""