6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 21:43:06 +01:00
firebird-qa/tests/bugs/core_5279_test.py

61 lines
1.3 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5557
ISSUE: 5557
TITLE: Granting access rights to view is broken
DESCRIPTION:
JIRA: CORE-5279
FBTEST: bugs.core_5279
2022-01-25 22:55:48 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
tmp_user = user_factory('db', name='tmp$c5279', password='123')
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
recreate table test (id integer);
recreate table test1 (id integer);
commit;
2022-01-25 22:55:48 +01:00
create or alter view v_test as
select *
from test
2021-04-26 20:07:00 +02:00
where id in (select id from test1);
commit;
grant select on v_test to public;
2022-01-25 22:55:48 +01:00
grant select on test1 to view v_test;
2021-04-26 20:07:00 +02:00
commit;
insert into test(id) values(1);
insert into test(id) values(2);
insert into test(id) values(3);
insert into test1(id) values(3);
insert into test1(id) values(4);
insert into test1(id) values(5);
commit;
connect '$(DSN)' user tmp$c5279 password '123';
set count on;
set list on;
select current_user as who_am_i, v.* from v_test v;
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
WHO_AM_I TMP$C5279
ID 3
Records affected: 1
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0.1')
2022-01-25 22:55:48 +01:00
def test_1(act: Action, tmp_user: User):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00