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

78 lines
1.6 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: 2066
TITLE: CREATE OR ALTER VIEW statement
DESCRIPTION:
JIRA: CORE-1640
FBTEST: bugs.core_1640
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
2022-01-20 17:32:14 +01:00
init_script = """create table users (
2021-04-26 20:07:00 +02:00
id integer,
name varchar(20),
passwd varchar(20)
);
commit;"""
2022-01-20 17:32:14 +01:00
db = db_factory(init=init_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
test_script = """create or alter view v_users as
2021-04-26 20:07:00 +02:00
select name from users;
commit;
show view v_users;
create or alter view v_users (id, name, passwd ) as
select id, name, passwd from users;
commit;
show view v_users;
create or alter view v_users_name as
select name from v_users;
commit;
create or alter view v_users (id, name ) as
select id, name from users;
commit;
show view v_users;
show view v_users_name;
"""
2022-01-20 17:32:14 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-20 17:32:14 +01:00
expected_stdout = """ NAME VARCHAR(20) Nullable
2021-04-26 20:07:00 +02:00
View Source:
==== ======
select name from users
2022-01-20 17:32:14 +01:00
ID INTEGER Nullable
2021-04-26 20:07:00 +02:00
NAME VARCHAR(20) Nullable
PASSWD VARCHAR(20) Nullable
View Source:
==== ======
select id, name, passwd from users
2022-01-20 17:32:14 +01:00
ID INTEGER Nullable
2021-04-26 20:07:00 +02:00
NAME VARCHAR(20) Nullable
View Source:
==== ======
select id, name from users
2022-01-20 17:32:14 +01:00
NAME VARCHAR(20) Nullable
2021-04-26 20:07:00 +02:00
View Source:
==== ======
select name from v_users
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()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00