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

102 lines
2.4 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
#
# id: bugs.core_0800
# title: Easy metadata extract improvements
2021-11-10 19:02:05 +01:00
# decription:
2021-04-26 20:07:00 +02:00
# Domain DDL: move its CHECK clause from 'create' to 'alter' statement.
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# tracker_id: CORE-0800
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
2021-11-10 19:02:05 +01:00
from firebird.qa import db_factory, python_act, Action
2021-04-26 20:07:00 +02:00
# version: 3.0
# resources: None
substitutions_1 = []
init_script_1 = """
set term ^;
execute block as
begin
begin
execute statement 'drop domain dm_test';
when any do begin end
end
begin
execute statement 'drop collation name_coll';
when any do begin end
end
end^
set term ;^
commit;
create collation name_coll for utf8 from unicode no pad case insensitive accent insensitive;
commit;
2021-11-10 19:02:05 +01:00
create domain dm_test varchar(20)
character set utf8
default 'foo'
not null
2021-04-26 20:07:00 +02:00
check (value in ('foo', 'rio', 'bar'))
collate name_coll
;
commit;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
db_1 = db_factory(charset='UTF8', sql_dialect=3, init=init_script_1)
# test_script_1
#---
# import os
# import subprocess
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# db_conn.close()
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# os.environ["ISC_USER"] = user_name
# os.environ["ISC_PASSWORD"] = user_password
# db_file="$(DATABASE_LOCATION)bugs.core_0800.fdb"
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# f_extract_meta = open( os.path.join(context['temp_directory'],'tmp_meta_0800_init.sql'), 'w')
# subprocess.call( [context['isql_path'], dsn, "-x", "-ch", "utf8"],
# stdout = f_extract_meta,
# stderr = subprocess.STDOUT
# )
# f_extract_meta.close()
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# with open( f_extract_meta.name, 'r') as f:
# for line in f:
# if 'ALTER DOMAIN' in line.upper():
# print( line )
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# ###############################
# # Cleanup.
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# f_list=[]
# f_list.append(f_extract_meta)
2021-11-10 19:02:05 +01:00
#
2021-04-26 20:07:00 +02:00
# for i in range(len(f_list)):
# if os.path.isfile(f_list[i].name):
# os.remove(f_list[i].name)
2021-11-10 19:02:05 +01:00
#
#
2021-04-26 20:07:00 +02:00
#---
2021-11-10 19:02:05 +01:00
act_1 = python_act('db_1', substitutions=substitutions_1)
2021-04-26 20:07:00 +02:00
expected_stdout_1 = """
ALTER DOMAIN DM_TEST ADD CONSTRAINT
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2021-11-10 19:02:05 +01:00
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.extract_meta()
expected = ''.join([x for x in act_1.clean_stdout.splitlines() if 'ALTER DOMAIN' in x.upper()])
assert act_1.clean_expected_stdout == expected
2021-04-26 20:07:00 +02:00