diff --git a/tests/bugs/core_4743_test.py b/tests/bugs/core_4743_test.py index 881578bb..a5bfd9f6 100644 --- a/tests/bugs/core_4743_test.py +++ b/tests/bugs/core_4743_test.py @@ -8,6 +8,14 @@ DESCRIPTION: NOTES: [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-4743 FBTEST: bugs.core_4743 """ @@ -16,92 +24,91 @@ import pytest import platform from firebird.qa import * -db = db_factory(charset='UTF8') - +db = db_factory(utf8filename=True) non_acii_user = user_factory('db', name='"Вася Пупкин"', password= '123') test_role = role_factory('db', name='"Старший дворник"') act = python_act('db', substitutions=[('[\t ]+', ' ')]) ddl_script = """ -grant "Старший дворник" to "Вася Пупкин"; -commit; + grant "Старший дворник" to "Вася Пупкин"; + commit; -create table "Документы"(id int primary key, pid int references "Документы"); -create exception "НЕ_число" 'Ваша строка не может быть преобразована в число.'; -create sequence "ИД_документа"; -set term ^; -create procedure "Хранимка" as -begin -end -^ -create function "СтрВЧисло"(a_text varchar(100)) returns int as -begin - return 0; -end -^ - -create or alter package "Утилиты" as -begin - procedure pg_sp_worker; -end -^ -recreate package body "Утилиты" as -begin - procedure pg_sp_worker as + create table "Документы"(id int primary key, pid int references "Документы"); + create exception "НЕ_число" 'Ваша строка не может быть преобразована в число.'; + create sequence "ИД_документа"; + set term ^; + create procedure "Хранимка" as begin end -end -^ -set term ;^ -commit; + ^ + create function "СтрВЧисло"(a_text varchar(100)) returns int as + begin + return 0; + end + ^ -create or alter view v_current_privileges as -select - g.rdb$user as who_is_granted - ,g.rdb$relation_name as obj_name - ,decode( g.rdb$object_type - ,0,'table' - ,1,'view' - ,2,'trigger' - ,5,'procedure' - ,7,'exception' - ,9,'domain' - ,11,'charset' - ,13,'role' - ,14,'generator' - ,15,'function' - ,16,'blob filt' - ,18,'package' - ,22,'systable' - ,cast(g.rdb$object_type as varchar(50)) - ) as obj_type - ,max(iif(g.rdb$privilege='S','YES',' ')) as "privilege:select" - ,max(iif(g.rdb$privilege='I','YES',' ')) as "privilege:insert" - ,max(iif(g.rdb$privilege='U','YES',' ')) as "privilege:update" - ,max(iif(g.rdb$privilege='D','YES',' ')) as "privilege:delete" - ,max(iif(g.rdb$privilege='G','YES',' ')) as "privilege:usage" - ,max(iif(g.rdb$privilege='X','YES',' ')) as "privilege:exec" - ,max(iif(g.rdb$privilege='R','YES',' ')) as "privilege:refer" - ,max(iif(g.rdb$privilege='C','YES',' ')) as "privilege:create" - ,max(iif(g.rdb$privilege='L','YES',' ')) as "privilege:alter" - ,max(iif(g.rdb$privilege='O','YES',' ')) as "privilege:drop" - ,max(iif(g.rdb$privilege='M','YES',' ')) as "privilege:member" -from rdb$user_privileges g -where g.rdb$user in( current_user, current_role ) -group by 1,2,3; + create or alter package "Утилиты" as + begin + procedure pg_sp_worker; + end + ^ + recreate package body "Утилиты" as + begin + procedure pg_sp_worker as + begin + end + end + ^ + set term ;^ + commit; -grant select on v_current_privileges to "Старший дворник"; -grant select,insert,update,delete,references on "Документы" to "Старший дворник"; -grant usage on exception "НЕ_число" to "Старший дворник"; -grant usage on sequence "ИД_документа" to "Старший дворник"; -grant execute on procedure "Хранимка" to "Старший дворник"; -grant execute on function "СтрВЧисло" to "Старший дворник"; -grant execute on package "Утилиты" to "Старший дворник"; -grant create table to "Старший дворник"; -grant alter any table to "Старший дворник"; -grant drop any table to "Старший дворник"; -commit; + create or alter view v_current_privileges as + select + g.rdb$user as who_is_granted + ,g.rdb$relation_name as obj_name + ,decode( g.rdb$object_type + ,0,'table' + ,1,'view' + ,2,'trigger' + ,5,'procedure' + ,7,'exception' + ,9,'domain' + ,11,'charset' + ,13,'role' + ,14,'generator' + ,15,'function' + ,16,'blob filt' + ,18,'package' + ,22,'systable' + ,cast(g.rdb$object_type as varchar(50)) + ) as obj_type + ,max(iif(g.rdb$privilege='S','YES',' ')) as "privilege:select" + ,max(iif(g.rdb$privilege='I','YES',' ')) as "privilege:insert" + ,max(iif(g.rdb$privilege='U','YES',' ')) as "privilege:update" + ,max(iif(g.rdb$privilege='D','YES',' ')) as "privilege:delete" + ,max(iif(g.rdb$privilege='G','YES',' ')) as "privilege:usage" + ,max(iif(g.rdb$privilege='X','YES',' ')) as "privilege:exec" + ,max(iif(g.rdb$privilege='R','YES',' ')) as "privilege:refer" + ,max(iif(g.rdb$privilege='C','YES',' ')) as "privilege:create" + ,max(iif(g.rdb$privilege='L','YES',' ')) as "privilege:alter" + ,max(iif(g.rdb$privilege='O','YES',' ')) as "privilege:drop" + ,max(iif(g.rdb$privilege='M','YES',' ')) as "privilege:member" + from rdb$user_privileges g + where g.rdb$user in( current_user, current_role ) + group by 1,2,3; + + grant select on v_current_privileges to "Старший дворник"; + grant select,insert,update,delete,references on "Документы" to "Старший дворник"; + grant usage on exception "НЕ_число" to "Старший дворник"; + grant usage on sequence "ИД_документа" to "Старший дворник"; + grant execute on procedure "Хранимка" to "Старший дворник"; + grant execute on function "СтрВЧисло" to "Старший дворник"; + grant execute on package "Утилиты" to "Старший дворник"; + grant create table to "Старший дворник"; + grant alter any table to "Старший дворник"; + grant drop any table to "Старший дворник"; + commit; """ expected_stdout = """ @@ -160,7 +167,8 @@ expected_stdout = """ privilege:exec : YES """ -@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') +#@pytest.mark.skipif(platform.system() == 'Windows', reason='FIXME: see notes') + @pytest.mark.version('>=4.0') def test_1(act: Action, non_acii_user: User, test_role: Role, capsys): act.isql(switches=['-b', '-q'], input=ddl_script)