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_4301_test.py

72 lines
2.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4624
ISSUE: 4624
TITLE: Non-ASCII data in SEC$USERS is not read correctly
DESCRIPTION:
JIRA: CORE-4301
FBTEST: bugs.core_4301
NOTES:
[04.09.2024] pzotov
Added 'using plugin Srp' into 'CREATE USER' statements, in order to check 'COMMENT ON USER' with non-ascii text.
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory(charset='UTF8')
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
# Note use of "do_not_create", as we want to create user in test script
# but we want to clean it up via fixture teardown
user_a = user_factory('db', name='u30a', password='u30a', do_not_create=True)
user_b = user_factory('db', name='u30b', password='u30b', do_not_create=True)
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
test_script = """
2021-12-19 22:25:36 +01:00
-- Field `firstname` is defined as:
-- VARCHAR(32) CHARACTER SET UNICODE_FSS COLLATE UNICODE_FSS
2021-04-26 20:07:00 +02:00
-- we can put in it max 16 non-ascii characters
create or alter user u30a password 'u30a' firstname 'Полиграф Шариков' using plugin Srp;
create or alter user u30b password 'u30b' firstname 'Léopold Frédéric' using plugin Srp;
2021-04-26 20:07:00 +02:00
commit;
comment on user u30a is 'это кто-то из наших';
comment on user u30b is 'é alguém do Brasil';
commit;
/*
show domain rdb$user;
show domain SEC$NAME_PART;
show table sec$users;
*/
2021-04-26 20:07:00 +02:00
set list on;
select
-- 3.x: CHAR(31) CHARACTER SET UNICODE_FSS Nullable
-- 4.x, 5.x: (RDB$USER) CHAR(63) Nullable
-- FB 6.x: (RDB$USER) CHAR(63) CHARACTER SET UTF8 Nullable
u.sec$user_name
,u.sec$first_name -- (SEC$NAME_PART) VARCHAR(32) Nullable
,u.sec$description as descr_blob_id -- (RDB$DESCRIPTION) BLOB segment 80, subtype TEXT Nullable
2021-04-26 20:07:00 +02:00
from sec$users u
2021-12-19 22:25:36 +01:00
where upper(u.sec$user_name) in (upper('u30a'), upper('u30b'));
2021-04-26 20:07:00 +02:00
commit;
2021-12-19 22:25:36 +01:00
"""
2021-04-26 20:07:00 +02:00
act = isql_act('db', test_script, substitutions = [ ('DESCR_BLOB_ID.*',''),('[ \t]+',' ') ] )
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
expected_stdout = """
2021-12-19 22:25:36 +01:00
SEC$USER_NAME U30A
2021-04-26 20:07:00 +02:00
SEC$FIRST_NAME Полиграф Шариков
это кто-то из наших
2021-12-19 22:25:36 +01:00
SEC$USER_NAME U30B
2021-04-26 20:07:00 +02:00
SEC$FIRST_NAME Léopold Frédéric
é alguém do Brasil
2021-12-19 22:25:36 +01:00
"""
@pytest.mark.intl
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-23 20:41:55 +01:00
def test_1(act: Action, user_a: User, user_b: User):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00