6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 05:53:06 +01:00
firebird-qa/tests/functional/exception/drop/test_02.py

61 lines
1.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-02-04 19:05:19 +01:00
"""
ID: exception.drop-02
FBTEST: functional.exception.drop.02
TITLE: DROP EXCEPTION
DESCRIPTION:
Create exception and SP that uses it. Then try to drop exception - this attempt must FAIL.
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
init_script = """
2021-04-26 20:07:00 +02:00
create exception exc_test 'message to show';
commit;
set term ^;
create procedure sp_test as
begin
exception exc_test;
end ^
set term ;^
commit;
"""
2022-02-04 19:05:19 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
drop exception exc_test;
commit;
set list on;
set count on;
2022-02-04 19:05:19 +01:00
select e.rdb$exception_name, d.rdb$dependent_name
2021-04-26 20:07:00 +02:00
from rdb$exceptions e join rdb$dependencies d on e.rdb$exception_name = d.rdb$depended_on_name
where e.rdb$exception_name = upper('exc_test');
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
RDB$EXCEPTION_NAME EXC_TEST
RDB$DEPENDENT_NAME SP_TEST
Records affected: 1
"""
2022-02-04 19:05:19 +01:00
expected_stderr = """
2021-04-26 20:07:00 +02:00
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-cannot delete
-EXCEPTION EXC_TEST
-there are 1 dependencies
"""
2021-04-26 20:07:00 +02:00
2022-02-04 19:05:19 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.expected_stderr = expected_stderr
act.execute()
assert (act.clean_stderr == act.clean_expected_stderr and
act.clean_stdout == act.clean_expected_stdout)