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

67 lines
1.8 KiB
Python

#coding:utf-8
"""
ID: gtcs.proc-isql-20
TITLE: gtcs-proc-isql-20
DESCRIPTION:
Original test see in:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/PROC_ISQL_20.script
SQL script for creating test database ('gtcs_sp1.fbk') and fill it with some data:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/PROCS_QA_INIT_ISQL.script
FBTEST: functional.gtcs.gtcs_proc_isql_20
"""
import pytest
from firebird.qa import *
db = db_factory(from_backup='gtcs_sp1.fbk')
test_script = """
set term ^;
create procedure proc_select_insert3 as
declare t varchar(5);
begin
for
select sno
from s
where sno NOT IN (select sno from sp)
into :t
do begin
insert into sp(sno) values (:t);
exit;
end
end
^
set term ;^
select 'result-1' as msg, p.* from sp p;
execute procedure proc_select_insert3;
select 'result-2' as msg, p.* from sp p;
"""
act = isql_act('db', test_script, substitutions=[('={3,}', ''), ('[ \t]+', ' ')])
expected_stdout = """
MSG SNO PNO QTY
result-1 S1 P1 300
result-1 S1 P3 400
result-1 S2 P1 300
result-1 S2 P2 400
result-1 S4 P4 300
result-1 S4 P5 400
MSG SNO PNO QTY
result-2 S1 P1 300
result-2 S1 P3 400
result-2 S2 P1 300
result-2 S2 P2 400
result-2 S4 P4 300
result-2 S4 P5 400
result-2 S3 <null> <null>
"""
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout