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

54 lines
1.7 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
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-04-26 20:07:00 +02:00
-- Note: this test differs from ticket: instead of add COMMENTS to users
-- it only defines their `firstname` attribute, because sec$users.sec$description
-- can be displayed only when plugin UserManager = Srp.
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 'Полиграф Шариков';
create or alter user u30b password 'u30b' firstname 'Léopold Frédéric';
commit;
set list on;
select u.sec$user_name, u.sec$first_name
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
2022-01-23 20:41:55 +01:00
act = isql_act('db', test_script)
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
2021-12-19 22:25:36 +01:00
"""
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