6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated tests\bugs\core_4218_test.py: Added (temporary ?) 'credentials = False' to prevent ISQL from using '-USER ... -PASS ...'. IMO, this is bug; see https://github.com/FirebirdSQL/firebird/issues/8385

This commit is contained in:
pavel-zotov 2025-01-13 14:26:41 +03:00
parent 3bbf0047ba
commit f869ab0158

View File

@ -6,9 +6,17 @@ ISSUE: 4543
TITLE: Add database owner to mon$database
DESCRIPTION:
JIRA: CORE-4218
FBTEST: bugs.core_4218
NOTES:
[13.01.2025] pzotov
Added (temporary ?) 'credentials = False' to prevent ISQL from using '-USER ... -PASS ...'.
This is needed since 6.0.0.570, otherwise we get (on attempting to create DB):
Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
-Different logins in connect and attach packets - client library error
(IMO, this is bug; see https://github.com/FirebirdSQL/firebird/issues/8385)
"""
import time
import locale
import pytest
from pathlib import Path
from firebird.qa import *
@ -25,27 +33,29 @@ test_db = temp_file('owner-db.fdb')
def test_1(act: Action, tmp_user: User, test_db: Path):
with act.db.connect() as con:
c = con.cursor()
c.execute('grant create database to user TMP_U4218')
c.execute(f'grant create database to user {tmp_user.name}')
con.commit()
test_script = f"""
-- set echo on;
create database 'localhost:{test_db}' user {tmp_user.name} password '{tmp_user.password}';
set list on;
select current_user as who_am_i, mon$owner as who_is_owner from mon$database;
commit;
connect 'localhost:{test_db}';
connect 'localhost:{test_db}' user {act.db.user} password '{act.db.password}';
select current_user as who_am_i, mon$owner as who_is_owner from mon$database;
commit;
drop database;
quit;
"""
expected_stdout = f"""
WHO_AM_I {tmp_user.name.upper()}
WHO_IS_OWNER {tmp_user.name.upper()}
WHO_AM_I SYSDBA
WHO_AM_I {act.db.user}
WHO_IS_OWNER {tmp_user.name.upper()}
"""
act.expected_stdout = expected_stdout
act.isql(switches=['-q'], input=test_script, connect_db=False, combine_output = True)
act.isql(switches=['-q'], input=test_script, connect_db=False, combine_output = True, credentials = False, io_enc = locale.getpreferredencoding())
assert act.clean_stdout == act.clean_expected_stdout