tests: check against specific db name in test_delete_tenant_with_sql (#52649)

This commit is contained in:
Frédéric Péters 2021-04-02 10:56:17 +02:00
parent 8f1bf215fd
commit f3eb47d6f3
1 changed files with 6 additions and 3 deletions

View File

@ -205,7 +205,7 @@ def test_trigger_jumps(pub):
assert not f2.workflow_data assert not f2.workflow_data
def test_delete_tenant_with_sql(): def test_delete_tenant_with_sql(freezer):
pub = create_temporary_pub(sql_mode=True) pub = create_temporary_pub(sql_mode=True)
delete_cmd = CmdDeleteTenant() delete_cmd = CmdDeleteTenant()
@ -214,6 +214,7 @@ def test_delete_tenant_with_sql():
sub_options_class = collections.namedtuple('Options', ['force_drop']) sub_options_class = collections.namedtuple('Options', ['force_drop'])
sub_options = sub_options_class(False) sub_options = sub_options_class(False)
freezer.move_to('2018-12-01T00:00:00')
delete_cmd.delete_tenant(pub, sub_options, []) delete_cmd.delete_tenant(pub, sub_options, [])
assert not os.path.isdir(pub.app_dir) assert not os.path.isdir(pub.app_dir)
@ -225,7 +226,8 @@ def test_delete_tenant_with_sql():
cur.execute( cur.execute(
"""SELECT schema_name """SELECT schema_name
FROM information_schema.schemata FROM information_schema.schemata
WHERE schema_name like '%removed%'""" WHERE schema_name like 'removed_20181201_%%%s'"""
% pub.cfg['postgresql']['database']
) )
assert len(cur.fetchall()) == 1 assert len(cur.fetchall()) == 1
@ -299,7 +301,8 @@ def test_delete_tenant_with_sql():
cur.execute( cur.execute(
"""SELECT datname """SELECT datname
FROM pg_database FROM pg_database
WHERE datname like '%removed%'""" WHERE datname like 'removed_20181201_%%%s'"""
% pub.cfg['postgresql']['database']
) )
result = cur.fetchall() result = cur.fetchall()