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

Added/Updated tests\bugs\gh_7167_test.py: re-implemented in order to run both on Windows and Linux. See notes.

This commit is contained in:
pavel-zotov 2023-03-05 17:50:00 +03:00
parent 6f839d8f1f
commit 127e46a764

View File

@ -7,23 +7,28 @@ TITLE: Incorrect transliteration of field names in constraint violation er
DESCRIPTION:
NOTES:
[28.02.2023] pzotov
Confirmed bug on 4.0.1.2692.
Checked on 5.0.0.961, 4.0.3.2903 - all OK.
Confirmed bug on 4.0.1.2692 Windows and Linux.
NB: on Linux we have to write SQL script into file with encoding = cp1251
and run it as script, otherwise issue not reproduced.
Checked on Windows and Linux, builds 5.0.0.961, 4.0.3.2903 - all OK.
"""
import pytest
from firebird.qa import *
from pathlib import Path
import time
db = db_factory(charset = 'win1251')
act = python_act('db')
act = python_act('db', substitutions = [('After line \\d+ in file .*', '')])
tmp_sql = temp_file('tmp_gh_7167.tmp.sql')
expected_stdout = """
Statement failed, SQLSTATE = 23000
violation of PRIMARY or UNIQUE KEY constraint "уни" on table "абв"
-Problematic key value is ("аб" = 'аб', "вг" = 'аб', "де" = 'аб')
"""
@pytest.mark.version('>=4.0.2')
def test_1(act: Action):
def test_1(act: Action, tmp_sql: Path):
test_sql = """
create table "абв" (
"аб" varchar(5) character set win1251,
@ -34,6 +39,7 @@ def test_1(act: Action):
insert into "абв" values ('аб','аб','аб');
insert into "абв" values ('аб','аб','аб');
"""
tmp_sql.write_bytes(test_sql.encode('cp1251'))
act.expected_stdout = expected_stdout
act.isql(switches=['-q'], charset = 'win1251', input = test_sql, combine_output = True)
act.isql(switches=['-q'], charset = 'win1251', input_file = tmp_sql, combine_output = True)
assert act.clean_stdout == act.clean_expected_stdout