From 5564d0f2ee9b33d30471eafef30efa71c7c47459 Mon Sep 17 00:00:00 2001 From: Adam Chainz Date: Wed, 1 Apr 2015 22:33:27 +0100 Subject: Fixed #24560 -- Added a --dry-run mode to the createcachetable command. --- tests/cache/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/cache') 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 -- cgit v1.3