From 045c44b0355411f8ea01ad9a2f11c3867050d4cc Mon Sep 17 00:00:00 2001 From: pavel-zotov Date: Mon, 22 Jul 2024 20:36:58 +0300 Subject: [PATCH] Added/Updated tests\bugs\gh_6120_test.py: Checked on 6.0.0.396, 5.0.1.1440, 4.0.5.3127, 3.0.12.33765 --- tests/bugs/gh_6120_test.py | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/bugs/gh_6120_test.py diff --git a/tests/bugs/gh_6120_test.py b/tests/bugs/gh_6120_test.py new file mode 100644 index 00000000..1009f6df --- /dev/null +++ b/tests/bugs/gh_6120_test.py @@ -0,0 +1,58 @@ +#coding:utf-8 + +""" +ID: issue-6120 +ISSUE: https://github.com/FirebirdSQL/firebird/issues/6120 +TITLE: Support auth_plugin_list dpb/spb item from application to client [CORE5860] +DESCRIPTION: +NOTES: + [22.07.2024] pzotov + Checked on 6.0.0.396, 5.0.1.1440, 4.0.5.3127, 3.0.12.33765 +""" +import pytest +from firebird.qa import * +from firebird.driver import driver_config, connect, NetProtocol, DatabaseError + +db = db_factory() +act = python_act('db') + +tmp_srp_user = user_factory('db', name='tmp$6120_srp', password='123', plugin = 'Srp') +tmp_leg_user = user_factory('db', name='tmp$6120_leg', password='456', plugin = 'Legacy_UserManager') + +@pytest.mark.version('>=3.0.3') +def test_1(act: Action, tmp_srp_user: User, tmp_leg_user: User, capsys): + + srv_cfg = driver_config.register_server(name = 'srv_cfg_6120', config = '') + + db_cfg_name = f'db_cfg_6120' + + # DatabaseConfig; see PYTHON_HOME/Lib/site-packages/firebird/driver/config.py: + db_cfg_object = driver_config.register_database(name = db_cfg_name) + + db_cfg_object.server.value = srv_cfg.name + db_cfg_object.protocol.value = NetProtocol.INET + db_cfg_object.database.value = str(act.db.db_path) + db_cfg_object.auth_plugin_list.value = ','.join( ['Srp', 'Legacy_Auth'] ) + + for u in (tmp_srp_user, tmp_leg_user): + with connect(db_cfg_name, user = u.name, password = u.password) as con: + cur = con.cursor() + try: + cur.execute('select trim(mon$user) as mon_user, mon$auth_method as auth_way from mon$attachments') + ccol=cur.description + for r in cur: + for i in range(0,len(ccol)): + print( ccol[i][0],':', r[i] ) + except DatabaseError as e: + print(e.__str__()) + + act.expected_stdout = f""" + MON_USER : TMP$6120_SRP + AUTH_WAY : Srp + + MON_USER : TMP$6120_LEG + AUTH_WAY : Legacy_Auth + """ + act.stdout = capsys.readouterr().out + assert act.clean_stdout == act.clean_expected_stdout + act.reset()