summaryrefslogtreecommitdiffstats
path: root/tests_multitenant/test_create_tenant.py
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2019-07-03 07:28:57 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2019-07-04 06:01:16 (GMT)
commit02b1ef8c2ee12bd9e22995e0319657c56e8aad35 (patch)
tree2d0ec71d6dd50c5084b306f1ca4da293bd329a65 /tests_multitenant/test_create_tenant.py
parentd4790d882b684d55021749200b5c57b6df0a7ee0 (diff)
downloadhobo-02b1ef8c2ee12bd9e22995e0319657c56e8aad35.zip
hobo-02b1ef8c2ee12bd9e22995e0319657c56e8aad35.tar.gz
hobo-02b1ef8c2ee12bd9e22995e0319657c56e8aad35.tar.bz2
do not use public schema for finding list of migrations (#31042)v1.27
Diffstat (limited to 'tests_multitenant/test_create_tenant.py')
-rw-r--r--tests_multitenant/test_create_tenant.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests_multitenant/test_create_tenant.py b/tests_multitenant/test_create_tenant.py
index b7aafcf..ac5937d 100644
--- a/tests_multitenant/test_create_tenant.py
+++ b/tests_multitenant/test_create_tenant.py
@@ -63,3 +63,24 @@ def test_create_tenant_failure(db, caplog):
with connection.cursor() as cursor:
cursor.execute('select schema_name from information_schema.schemata')
assert 'www_example_com' not in [row[0] for row in cursor.fetchall()]
+
+
+def test_migrate_schemas_skip_applied(db, capsys):
+ assert not schema_exists('www_example_com')
+ call_command('create_tenant', 'www.example.com')
+ captured = capsys.readouterr()
+ assert 'Running migrate for schema www_example_com' in captured.out
+ call_command('migrate_schemas', verbosity=1)
+ captured = capsys.readouterr()
+ assert 'Skipping migrations of schema www_example_com' in captured.out
+ call_command('migrate_schemas', 'common', '0001_initial', verbosity=1)
+ captured = capsys.readouterr()
+ assert 'Running migrate for schema www_example_com' in captured.out
+ assert 'Unapplying common.0002' in captured.out
+ call_command('migrate_schemas', verbosity=1)
+ captured = capsys.readouterr()
+ assert 'Running migrate for schema www_example_com' in captured.out
+ assert 'Applying common.0002' in captured.out
+ call_command('migrate_schemas', verbosity=1)
+ captured = capsys.readouterr()
+ assert 'Skipping migrations of schema www_example_com' in captured.out