File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
tests/functional/view/create Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change 1010import pytest
1111from firebird .qa import *
1212
13- init_script = """CREATE TABLE tb(id INT);
14- commit;
15- """
16-
17- db = db_factory (init = init_script )
13+ db = db_factory ()
1814
19- test_script = """CREATE VIEW test (id) AS SELECT id FROM tb WHERE id<10 WITH CHECK OPTION;
20- INSERT INTO test VALUES(10);
15+ test_script = """
16+ create table test(id int);
17+ create view v_test (id) as select id from test where id<10 with check option;
18+ insert into v_test values(10);
2119"""
2220
2321act = isql_act ('db' , test_script , substitutions = [('-At trigger.*' , '' )])
2422
25- expected_stderr = """Statement failed, SQLSTATE = 23000
26- Operation violates CHECK constraint on view or table TEST
27- -At trigger 'CHECK_1'
28- """
29-
3023@pytest .mark .version ('>=3.0' )
3124def test_1 (act : Action ):
32- act .expected_stderr = expected_stderr
33- act .execute ()
34- assert act .clean_stderr == act .clean_expected_stderr
25+
26+ SQL_SCHEMA_PREFIX = '' if act .is_version ('<6' ) else '"PUBLIC".'
27+ TEST_VEW_NAME = "V_TEST" if act .is_version ('<6' ) else f'{ SQL_SCHEMA_PREFIX } "V_TEST"'
28+ expected_stdout = f"""
29+ Statement failed, SQLSTATE = 23000
30+ Operation violates CHECK constraint on view or table { TEST_VEW_NAME }
31+ """
32+ act .expected_stdout = expected_stdout
33+ act .execute (combine_output = True )
34+ assert act .clean_stdout == act .clean_expected_stdout
You can’t perform that action at this time.
0 commit comments