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

Added/Updated tests\functional\table\alter\test_11.py: Removed SHOW command for check result because its output often changes. It is enough for this test to obtain similar data from RDB tables. Created view and stored function to obtain type name by rdb$fields.rdb$field_type and .rdb$field_sub_type.

This commit is contained in:
pavel-zotov 2023-10-07 13:21:25 +03:00
parent efe86d26e8
commit 9c7b98a00d

View File

@ -5,30 +5,47 @@ ID: table.alter-11
TITLE: ALTER TABLE - DROP CONSTRAINT - UNIQUE
DESCRIPTION:
FBTEST: functional.table.alter.11
NOTES:
[06.10.2023] pzotov
Removed SHOW command. It is enough to check that we can add duplicate values in the table w/o UNQ.
"""
import pytest
from firebird.qa import *
init_script = """CREATE TABLE test( id INTEGER NOT NULL CONSTRAINT unq UNIQUE,
text VARCHAR(32));
db = db_factory(charset = 'utf8')
test_script = """
set bail on;
set list on;
create table test(x int, y int, constraint test_unq unique(x,y) );
alter table test drop constraint test_unq;
commit;
insert into test(x, y) values(1234, 4321);
insert into test(x, y) values(1234, 4321);
insert into test(x, y) values(null, null);
insert into test(x, y) values(null, null);
commit;
-- this must show records with duplicates in (x,y):
select * from test order by x,y;
commit;
"""
db = db_factory(init=init_script)
test_script = """ALTER TABLE test DROP CONSTRAINT unq;
SHOW TABLE test;
"""
act = isql_act('db', test_script)
expected_stdout = """ID INTEGER Not Null
TEXT VARCHAR(32) Nullable
expected_stdout = """
X <null>
Y <null>
X <null>
Y <null>
X 1234
Y 4321
X 1234
Y 4321
"""
@pytest.mark.version('>=3.0')
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
act.execute(combine_output = True)
assert act.clean_stdout == act.clean_expected_stdout