2021-04-26 20:07:00 +02:00
|
|
|
#coding:utf-8
|
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
"""
|
|
|
|
ID: issue-2240
|
|
|
|
ISSUE: 2240
|
|
|
|
TITLE: Usernames with '.' character
|
|
|
|
DESCRIPTION:
|
|
|
|
JIRA: CORE-1810
|
2022-02-02 15:46:19 +01:00
|
|
|
FBTEST: bugs.core_1810
|
2022-01-20 17:32:14 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
import pytest
|
|
|
|
from firebird.qa import *
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
db = db_factory()
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
test_script = """
|
2021-04-26 20:07:00 +02:00
|
|
|
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;
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
act = isql_act('db', test_script,
|
|
|
|
substitutions=[('Statement failed, SQLSTATE.*', ''), ('record not found for user:.*', '')])
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
expected_stdout = """
|
2021-04-26 20:07:00 +02:00
|
|
|
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-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-04-26 20:07:00 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
expected_stderr = """
|
2021-10-21 19:29:23 +02:00
|
|
|
Statement failed, SQLSTATE = HY000
|
|
|
|
record not found for user: $.$
|
2021-12-22 20:23:11 +01:00
|
|
|
"""
|
2021-10-21 19:29:23 +02:00
|
|
|
|
2022-01-20 17:32:14 +01:00
|
|
|
@pytest.mark.version('>=3')
|
|
|
|
def test_1(act: Action):
|
|
|
|
act.expected_stdout = expected_stdout
|
|
|
|
act.expected_stderr = expected_stderr
|
|
|
|
act.execute()
|
|
|
|
assert (act.clean_stdout == act.clean_expected_stdout and
|
|
|
|
act.clean_stderr == act.clean_expected_stderr)
|
2021-04-26 20:07:00 +02:00
|
|
|
|