mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #24560 -- Added a --dry-run mode to the createcachetable command.
This commit is contained in:
parent
727e40c879
commit
5564d0f2ee
5 changed files with 40 additions and 4 deletions
11
tests/cache/tests.py
vendored
11
tests/cache/tests.py
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue