6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_4760_test.py

55 lines
2.0 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5063
ISSUE: https://github.com/FirebirdSQL/firebird/issues/5063
2022-01-24 20:27:02 +01:00
TITLE: Can not create user with non-ascii (multi-byte) characters in it's name
DESCRIPTION:
NOTES:
[24.11.2021] pcisar
1. This problem is covered by test for #5048 (CORE-4743; https://github.com/FirebirdSQL/firebird/issues/5048 ) as side effect
2022-01-24 20:27:02 +01:00
2. For sake of completness, it was reimplemented by simply using
user_factory fixture.
2022-02-09 20:47:40 +01:00
[09.02.2022] pcisar
On Windows the act.db.connect() fails with "Your user name and password are not defined."
[08.04.2022] pzotov
One need to specify utf8filename=True in db_factory() call if we want to establish connection as "non-ascii user".
Specifying of this parameter in firebird-driver.conf (in the servger section) has no effect.
Checked on 4.0.1 Release, 5.0.0.467.
See also:
email discusion, subject: "firebird-qa [new framework]: unable to make connection as NON-ASCII user, only on Windows (WI-V4.0.1.2692)",
message from pcisar 08-mar-2022 13:52 ('utf8filename' parameter was added to db_factory()).
JIRA: CORE-4760
FBTEST: bugs.core_4760
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
2022-02-09 20:47:40 +01:00
import platform
2022-01-24 20:27:02 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
db = db_factory(utf8filename=True)
2021-11-26 19:20:43 +01:00
NON_ASCII_NAME = 'Εὐκλείδης'
non_ascii_user = user_factory('db', name=f'"{NON_ASCII_NAME}"', password='123')
2021-11-26 19:20:43 +01:00
2022-01-24 20:27:02 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
expected_stdout=f"""
WHOAMI : {NON_ASCII_NAME}
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
def test_1(act: Action, non_ascii_user: User, capsys):
2022-01-24 20:27:02 +01:00
with act.db.connect(user=non_ascii_user.name, password=non_ascii_user.password) as con:
cur = con.cursor()
cur.execute( 'select mon$user as whoami from mon$attachments where mon$attachment_id = current_connection')
col = cur.description
for r in cur:
for i in range(len(col)):
print(' '.join((col[i][0], ':', r[i])))
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout