6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/bugs/core_1640_test.py

69 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-21 18:49:26 +01:00
"""
ID: issue-2066
ISSUE: https://github.com/FirebirdSQL/firebird/issues/2066
2022-01-21 18:49:26 +01:00
TITLE: CREATE OR ALTER VIEW statement
DESCRIPTION:
JIRA: CORE-1640
FBTEST: bugs.core_1640
NOTES:
[05.10.2023] pzotov
Removed SHOW VIEW command for check result because its output often changes.
2022-01-21 18:49:26 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
from firebird.qa import db_factory, isql_act, Action
init_script = """
create table users (
2021-04-26 20:07:00 +02:00
id integer,
name varchar(20),
passwd varchar(20)
);
commit;
insert into users(id, name, passwd) values(1,'john','12345');
2021-04-26 20:07:00 +02:00
commit;
"""
2021-04-26 20:07:00 +02:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
test_script = """
set bail on;
set list on;
create or alter view v_users as
select name from users;
commit;
alter view v_users (id, name, passwd ) as select id, name, passwd from users;
select * from v_users;
commit;
alter view v_users as select name from users;
select * from v_users;
commit;
alter view v_users (id, name ) as select id, name from users;
select * from v_users;
commit;
2021-04-26 20:07:00 +02:00
"""
2022-01-20 17:32:14 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
expected_stdout = """
ID 1
NAME john
PASSWD 12345
2021-04-26 20:07:00 +02:00
NAME john
2021-04-26 20:07:00 +02:00
ID 1
NAME john
2022-01-20 17:32:14 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute(combine_output = True)
2022-01-20 17:32:14 +01:00
assert act.clean_stdout == act.clean_expected_stdout