Skip to content

Commit

Permalink
Adds a test for unicode table names.
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandBordage committed Mar 9, 2015
1 parent 658184b commit c9b1269
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cachalot/tests/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,3 +580,18 @@ def test_missing_table_cache_key(self):

with self.assertNumQueries(1):
list(Test.objects.all())

def test_unicode_table_name(self):
"""
Tests if using unicode in table names does not break caching.
"""
cursor = connection.cursor()
table_name = 'Clémentine'
if connection.vendor == 'postgresql':
table_name = '"%s"' % table_name
cursor.execute('CREATE TABLE %s (taste VARCHAR(20));' % table_name)
with self.assertNumQueries(1):
list(Test.objects.extra(tables=['Clémentine']))
with self.assertNumQueries(0):
list(Test.objects.extra(tables=['Clémentine']))
cursor.execute('DROP TABLE %s;' % table_name)

0 comments on commit c9b1269

Please sign in to comment.