6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00

Added/Updated tests\bugs\core_3489_test.py: Re-implemented. See notes. Checked on 6.0.0.511 (Windows/Linux); 5.0.2.1550; 4.0.6.3165; 3.0.2.32670, 3,0,1,32609

This commit is contained in:
pavel-zotov 2024-10-30 23:44:28 +03:00
parent d2c60eef34
commit 264a8864e9

View File

@ -1,66 +1,102 @@
#coding:utf-8 #coding:utf-8
""" """
ID: issue-3848 ID: issue-3848
ISSUE: 3848 ISSUE: 3848
TITLE: Blob transliteration may not happen inside the union TITLE: Blob transliteration may not happen inside the union
DESCRIPTION: DESCRIPTION:
JIRA: CORE-3489 JIRA: CORE-3489
FBTEST: bugs.core_3489 FBTEST: bugs.core_3489
NOTES: NOTES:
[06.10.2022] pzotov [30.10.2024] pzotov
Could not complete adjusting for LINUX in new-qa. Bug was fixed for too old FB (3.0 Alpha 1), firebird-driver and/or QA-plugin will not able to run on this version.
DEFERRED. to check this version in order to reproduce problem.
""" Source for this test was taken from ticket almost w/o changes. Only aux view has been added ('v_conn_cset') for
import platform showing current connection protocol and character set - we make query to this view two twice: one for TCP and then
import pytest for local protocol.
from pathlib import Path
from firebird.qa import * Checked on 6.0.0.511 (Windows/Linux); 5.0.2.1550; 4.0.6.3165; 3.0.2.32670, 3,0,1,32609
"""
init_script = """
set term ^; import locale
create or alter procedure sp_test from pathlib import Path
returns ( import pytest
msg_blob_id blob sub_type 1 segment size 80 character set unicode_fss) from firebird.qa import *
AS
begin db = db_factory(charset='WIN1251')
msg_blob_id= 'Это проверка на вывод строки "Йцукёнг"'; -- text in cyrillic
suspend; act = python_act('db', substitutions=[('MSG_BLOB_ID.*', ''), ('TCPv(4|6)', 'TCP')])
end
^ expected_stdout = """
set term ;^ CONN_PROTOCOL TCP
commit; CONNECTION_CSET WIN1251
""" DB_DEFAULT_CSET WIN1251
Records affected: 1
db = db_factory(charset='WIN1251', init=init_script) Это проверка на вывод строки "Йцукёнг"
Это проверка на вывод строки "Йцукёнг"
act = python_act('db', substitutions=[('MSG_BLOB_ID.*', '')]) Records affected: 2
expected_stdout = """ CONN_PROTOCOL <null>
Это проверка на вывод строки "Йцукёнг" CONNECTION_CSET WIN1251
Это проверка на вывод строки "Йцукёнг" DB_DEFAULT_CSET WIN1251
Records affected: 2 Records affected: 1
""" Это проверка на вывод строки "Йцукёнг"
Это проверка на вывод строки "Йцукёнг"
script_file = temp_file('test_script.sql') Records affected: 2
"""
@pytest.mark.skipif(platform.system() != 'Windows', reason='FIXME: see notes')
@pytest.mark.version('>=3') tmp_sql = temp_file('tmp_core_3489.sql')
def test_1(act: Action, script_file: Path):
script_file.write_text(""" @pytest.mark.version('>=3.0.0')
set list on; def test_1(act: Action, tmp_sql: Path):
set blob all; tmp_sql.write_text(
set count on; f"""
set list on; set bail on;
set list on;
select msg_blob_id set blob all;
from sp_test set count on;
union set names win1251;
select msg_blob_id connect '{act.db.dsn}';
from sp_test; create view v_conn_cset as
""", encoding='cp1251') select
act.expected_stdout = expected_stdout rdb$get_context('SYSTEM', 'NETWORK_PROTOCOL') as conn_protocol
act.isql(switches=[], input_file=script_file, charset='WIN1251') ,c.rdb$character_set_name as connection_cset
assert act.clean_stdout == act.clean_expected_stdout ,r.rdb$character_set_name as db_default_cset
from mon$attachments a
join rdb$character_sets c on a.mon$character_set_id = c.rdb$character_set_id
cross join rdb$database r where a.mon$attachment_id=current_connection;
set term ^;
create or alter procedure sp_test
returns (
msg_blob_id blob sub_type 1 segment size 80 character set unicode_fss)
AS
begin
msg_blob_id= 'Это проверка на вывод строки "Йцукёнг"'; -- text in cyrillic
suspend;
end
^
set term ;^
commit;
--------------------------
connect '{act.db.dsn}'; -- check TCP protocol
select * from v_conn_cset;
select msg_blob_id
from sp_test
union
select msg_blob_id
from sp_test;
commit;
--------------------------
connect '{act.db.db_path}'; -- check local protocol
select * from v_conn_cset;
select msg_blob_id
from sp_test
union
select msg_blob_id
from sp_test;
"""
,encoding='cp1251')
act.expected_stdout = expected_stdout
act.isql(switches = ['-q'], input_file = tmp_sql, charset = 'WIN1251', combine_output = True, connect_db = False)
assert act.clean_stdout == act.clean_expected_stdout