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_4985_test.py

73 lines
1.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_4985
# title: Non-privileged user can implicitly count records in a restricted table
2021-12-19 22:25:36 +01:00
# decription:
2021-04-26 20:07:00 +02:00
# tracker_id: CORE-4985
# min_versions: ['4.0']
# versions: 4.0
# qmid: None
import pytest
2021-12-19 22:25:36 +01:00
from firebird.qa import db_factory, isql_act, Action, user_factory, User
2021-04-26 20:07:00 +02:00
# version: 4.0
# resources: None
substitutions_1 = []
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
-- Checked on build of 24.03.2016 4.0 Unstable.
set wng off;
create table test(id int);
set count on;
insert into test select 1 from rdb$types rows 7;
commit;
revoke all on all from TMP$C4985;
commit;
connect '$(DSN)' user 'TMP$C4985' password '123';
set list on;
select current_user as who_am_i from rdb$database;
select count(*) from test;
set count on;
select 1 from test;
commit;
2021-12-19 22:25:36 +01:00
"""
2021-04-26 20:07:00 +02:00
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
Records affected: 7
WHO_AM_I TMP$C4985
Records affected: 1
2021-12-19 22:25:36 +01:00
"""
2021-04-26 20:07:00 +02:00
expected_stderr_1 = """
Statement failed, SQLSTATE = 28000
no permission for SELECT access to TABLE TEST
-Effective user is TMP$C4985
Statement failed, SQLSTATE = 28000
no permission for SELECT access to TABLE TEST
-Effective user is TMP$C4985
2021-12-19 22:25:36 +01:00
"""
user_1 = user_factory('db_1', name='TMP$C4985', password='123')
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2021-12-19 22:25:36 +01:00
def test_1(act_1: Action, user_1: User):
2021-04-26 20:07:00 +02:00
act_1.expected_stdout = expected_stdout_1
act_1.expected_stderr = expected_stderr_1
act_1.execute()
2021-12-22 20:23:11 +01:00
assert act_1.clean_stderr == act_1.clean_expected_stderr
assert act_1.clean_stdout == act_1.clean_expected_stdout
2021-04-26 20:07:00 +02:00