6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_1810_test.py

88 lines
2.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_1810
# title: Usernames with '.' character
2021-10-21 19:29:23 +02:00
# decription:
2021-04-26 20:07:00 +02:00
# tracker_id: CORE-1810
# min_versions: ['2.1.7']
# versions: 2.5
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 2.5
# resources: None
substitutions_1 = [('Statement failed, SQLSTATE.*', ''), ('record not found for user:.*', '')]
init_script_1 = """"""
db_1 = db_factory(page_size=4096, sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
set wng off;
recreate table test(id int, x int, y int, z int);
commit;
insert into test values(1, 100, 200, 300);
commit;
drop user "$.$";
commit;
create role "#.#";
commit;
create user "$.$" password '123';
2021-10-21 19:29:23 +02:00
commit;
2021-04-26 20:07:00 +02:00
revoke all on all from "$.$";
grant "#.#" to "$.$";
grant select on test to "#.#";
commit;
connect '$(DSN)' user "$.$" password '123' role "#.#";
commit;
2021-10-21 19:29:23 +02:00
select
current_user,
current_role,
2021-04-26 20:07:00 +02:00
iif( upper(a.mon$remote_protocol) starting with upper('TCP'), 'YES', 'NO!') is_remote_connection
2021-10-21 19:29:23 +02:00
from rdb$database m
2021-04-26 20:07:00 +02:00
join mon$attachments a on a.mon$attachment_id = current_connection
;
select * from test;
commit;
connect '$(DSN)' user 'SYSDBA' password 'masterkey';
commit;
drop user "$.$";
commit;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
USER $.$
ROLE #.#
IS_REMOTE_CONNECTION YES
2021-10-21 19:29:23 +02:00
2021-04-26 20:07:00 +02:00
ID 1
X 100
Y 200
Z 300
"""
2021-10-21 19:29:23 +02:00
expected_stderr_1 = """
Statement failed, SQLSTATE = HY000
record not found for user: $.$
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=2.5')
2021-04-28 12:42:11 +02:00
def test_1(act_1: Action):
2021-04-26 20:07:00 +02:00
act_1.expected_stdout = expected_stdout_1
2021-10-21 19:29:23 +02:00
act_1.expected_stderr = expected_stderr_1
2021-04-26 20:07:00 +02:00
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
2021-10-21 19:29:23 +02:00
assert act_1.clean_expected_stderr == act_1.clean_stderr
2021-04-26 20:07:00 +02:00