summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2015-04-01 22:33:27 +0100
committerTim Graham <timograham@gmail.com>2015-04-09 12:15:50 -0400
commit5564d0f2ee9b33d30471eafef30efa71c7c47459 (patch)
treee0ddcce25dd2249f1a34a9a2e575ba233a234fcc /tests
parent727e40c879f893a2c336e396aafdcad60b5d224c (diff)
Fixed #24560 -- Added a --dry-run mode to the createcachetable command.
Diffstat (limited to 'tests')
-rw-r--r--tests/cache/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index ffbed67197..9d29239cf6 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -943,6 +943,17 @@ class DBCacheTests(BaseCacheTests, TransactionTestCase):
self.assertEqual(out.getvalue(),
"Cache table 'test cache table' already exists.\n" * len(settings.CACHES))
+ @override_settings(CACHES=caches_setting_for_tests(
+ BACKEND='django.core.cache.backends.db.DatabaseCache',
+ # Use another table name to avoid the 'table already exists' message.
+ LOCATION='createcachetable_dry_run_mode'
+ ))
+ def test_createcachetable_dry_run_mode(self):
+ out = six.StringIO()
+ management.call_command('createcachetable', dry_run=True, stdout=out)
+ output = out.getvalue()
+ self.assertTrue(output.startswith("CREATE TABLE"))
+
def test_createcachetable_with_table_argument(self):
"""
Delete and recreate cache table with legacy behavior (explicitly