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

60 lines
2.2 KiB
Python

#coding:utf-8
"""
ID: gtcs.proc-isql-16
TITLE: gtcs-proc-isql-16
DESCRIPTION:
Original test see in:
https://github.com/FirebirdSQL/fbtcs/blob/master/GTCS/tests/PROC_ISQL_16.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_16
"""
import pytest
from firebird.qa import *
db = db_factory(from_backup='gtcs_sp1.fbk')
test_script = """
set term ^;
create procedure proc_insert (a char(5), b char(20), c char(6), d smallint, e char(15)) as
begin
insert into p values (:a, :b, :c, :d, :e);
end
^
set term ;^
select 'point-1' as msg, p.* from p;
execute procedure proc_insert 'P15', null , 'Pink', null, 'Hoboken';
insert into p values ('P16', null, null, null, 'Varanasi');
select 'point-2' as msg, p.* from p;
"""
act = isql_act('db', test_script, substitutions=[('={3,}', ''), ('[ \t]+', ' ')])
expected_stdout = """
MSG PNO PNAME COLOR WEIGHT CITY
point-1 P1 Nut Red 12 London
point-1 P2 Bolt Green 17 Paris
point-1 P3 Screw Blue 17 Rome
point-1 P4 Screw Red 14 London
point-1 P5 Cam Blue 12 Paris
point-1 P6 Cog Red 19 London
MSG PNO PNAME COLOR WEIGHT CITY
point-2 P1 Nut Red 12 London
point-2 P2 Bolt Green 17 Paris
point-2 P3 Screw Blue 17 Rome
point-2 P4 Screw Red 14 London
point-2 P5 Cam Blue 12 Paris
point-2 P6 Cog Red 19 London
point-2 P15 <null> Pink <null> Hoboken
point-2 P16 <null> <null> <null> Varanasi
"""
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout