mirror of
https://github.com/FirebirdSQL/firebird-qa.git
synced 2025-01-22 13:33:07 +01:00
Added/Updated tests\bugs\core_4464_test.py: Writing code requires more care since 6.0.0.150: ISQL does not allow specifying duplicate delimiters without any statements between them (two semicolon, two carets etc).
This commit is contained in:
parent
9185772aa7
commit
4603449087
@ -7,6 +7,9 @@ TITLE: Duplicate tags for CREATE/ALTER USER not handled correctly
|
||||
DESCRIPTION:
|
||||
JIRA: CORE-4464
|
||||
FBTEST: bugs.core_4464
|
||||
NOTES:
|
||||
[25.11.2023] pzotov
|
||||
Writing code requires more care since 6.0.0.150: ISQL does not allow specifying duplicate delimiters without any statements between them (two semicolon, two carets etc).
|
||||
"""
|
||||
|
||||
import pytest
|
||||
@ -18,80 +21,7 @@ user_1 = user_factory('db', name='tmp$c4464_1', do_not_create=True, plugin='Srp'
|
||||
user_2 = user_factory('db', name='tmp$c4464_2', do_not_create=True, plugin='Srp')
|
||||
user_3 = user_factory('db', name='tmp$c4464_3', do_not_create=True, plugin='Srp')
|
||||
|
||||
test_script = """
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate specification of added attr. 'initname':
|
||||
create user tmp$c4464_1 password '123'
|
||||
using plugin Srp
|
||||
tags (initname='Ozzy', surname='Osbourne', groupname='Black Sabbath', initname='John')
|
||||
;
|
||||
rollback; -- !! --
|
||||
|
||||
-- Should work OK:
|
||||
create user tmp$c4464_1 password '123'
|
||||
using plugin Srp
|
||||
tags (initname='John', surname='Osbourne', groupname='Black Sabbath', aka='Ozzy');
|
||||
;
|
||||
|
||||
-- Should work OK:
|
||||
create user tmp$c4464_2 password '456'
|
||||
using plugin Srp
|
||||
tags (initname='Ian', surname='Gillan', groupname='Deep Purple')
|
||||
;
|
||||
|
||||
create user tmp$c4464_3 password '789'
|
||||
using plugin Srp
|
||||
;
|
||||
commit;
|
||||
|
||||
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate specification of deleted attr. 'initname':
|
||||
alter user tmp$c4464_2
|
||||
using plugin Srp
|
||||
tags (drop initname, drop surname, drop groupname, drop initname);
|
||||
commit;
|
||||
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate tag to be added: initname
|
||||
alter user tmp$c4464_3
|
||||
using plugin Srp
|
||||
tags (initname='Ozzy', surname='Osbourne', groupname='Black Sabbath', initname='Foo');
|
||||
commit;
|
||||
|
||||
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate specification of removed and than added attr. 'initname':
|
||||
alter user tmp$c4464_3
|
||||
using plugin Srp
|
||||
tags (drop initname, surname='Gillan', groupname='Deep Purple', initname='Ian');
|
||||
commit;
|
||||
|
||||
set width usrname 12;
|
||||
set width tag_key 20;
|
||||
set width tag_val 25;
|
||||
set width sec_plg 7;
|
||||
select
|
||||
u.sec$user_name as usrname
|
||||
,a.sec$key tag_key
|
||||
,a.sec$value as tag_val
|
||||
,sec$plugin sec_plg
|
||||
from sec$users u
|
||||
left join sec$user_attributes a using( sec$user_name, sec$plugin )
|
||||
where u.sec$user_name in ( upper('tmp$c4464_1'), upper('tmp$c4464_2'), upper('tmp$c4464_3') )
|
||||
order by 1,2,3;
|
||||
commit;
|
||||
"""
|
||||
|
||||
act = isql_act('db', test_script, substitutions=[('=\\+', '')])
|
||||
act = python_act('db')
|
||||
|
||||
expected_stdout = """
|
||||
USRNAME TAG_KEY TAG_VAL SEC_PLG
|
||||
@ -122,9 +52,83 @@ expected_stderr = """
|
||||
|
||||
@pytest.mark.version('>=3.0')
|
||||
def test_1(act: Action, user_1: User, user_2: User, user_3: User):
|
||||
|
||||
test_script = f"""
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate specification of added attr. 'initname':
|
||||
create user {user_1.name} password '123'
|
||||
using plugin Srp
|
||||
tags (initname='Ozzy', surname='Osbourne', groupname='Black Sabbath', initname='John')
|
||||
;
|
||||
rollback; -- !! --
|
||||
|
||||
-- Should work OK:
|
||||
create user {user_1.name} password '123'
|
||||
using plugin Srp
|
||||
tags (initname='John', surname='Osbourne', groupname='Black Sabbath', aka='Ozzy')
|
||||
;
|
||||
|
||||
-- Should work OK:
|
||||
create user {user_2.name} password '456'
|
||||
using plugin Srp
|
||||
tags (initname='Ian', surname='Gillan', groupname='Deep Purple')
|
||||
;
|
||||
|
||||
create user {user_3.name} password '789'
|
||||
using plugin Srp
|
||||
;
|
||||
commit;
|
||||
|
||||
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate specification of deleted attr. 'initname':
|
||||
alter user {user_2.name}
|
||||
using plugin Srp
|
||||
tags (drop initname, drop surname, drop groupname, drop initname);
|
||||
commit;
|
||||
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate tag to be added: initname
|
||||
alter user {user_3.name}
|
||||
using plugin Srp
|
||||
tags (initname='Ozzy', surname='Osbourne', groupname='Black Sabbath', initname='Foo');
|
||||
commit;
|
||||
|
||||
|
||||
-- Should fail with:
|
||||
-- Statement failed, SQLSTATE = 42702
|
||||
-- Duplicated user attribute INITNAME
|
||||
-- - because of duplicate specification of removed and than added attr. 'initname':
|
||||
alter user {user_3.name}
|
||||
using plugin Srp
|
||||
tags (drop initname, surname='Gillan', groupname='Deep Purple', initname='Ian');
|
||||
commit;
|
||||
|
||||
set width usrname 12;
|
||||
set width tag_key 20;
|
||||
set width tag_val 25;
|
||||
set width sec_plg 7;
|
||||
select
|
||||
u.sec$user_name as usrname
|
||||
,a.sec$key tag_key
|
||||
,a.sec$value as tag_val
|
||||
,sec$plugin sec_plg
|
||||
from sec$users u
|
||||
left join sec$user_attributes a using( sec$user_name, sec$plugin )
|
||||
where u.sec$user_name in ( upper('{user_1.name}'), upper('{user_2.name}'), upper('{user_3.name}') )
|
||||
order by 1,2,3;
|
||||
commit;
|
||||
"""
|
||||
|
||||
act.expected_stdout = expected_stdout
|
||||
act.expected_stderr = expected_stderr
|
||||
act.execute()
|
||||
act.isql(switches=['-q'], input = test_script)
|
||||
assert (act.clean_stderr == act.clean_expected_stderr and
|
||||
act.clean_stdout == act.clean_expected_stdout)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user