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_5028_test.py

42 lines
954 B
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-25 22:55:48 +01:00
"""
ID: issue-5315
ISSUE: 5315
TITLE: Report the remote port number in MON$ATTACHMENTS
DESCRIPTION:
JIRA: CORE-5028
FBTEST: bugs.core_5028
2022-01-25 22:55:48 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
db = db_factory()
2021-11-26 19:20:43 +01:00
2022-01-25 22:55:48 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-25 22:55:48 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
OK
2021-11-26 19:20:43 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-25 22:55:48 +01:00
def test_1(act: Action, capsys):
with act.db.connect() as con:
2021-11-26 19:20:43 +01:00
c = con.cursor()
cmd = """
select iif(port > 0, 'OK', 'BAD') as port_value
from (
select cast(substring(mon$remote_address from 1 + position('/' in mon$remote_address)) as int) as port
from mon$attachments
where mon$attachment_id = current_connection)
2022-01-25 22:55:48 +01:00
"""
2021-11-26 19:20:43 +01:00
for row in c.execute(cmd):
print(row[0])
# Check
2022-01-25 22:55:48 +01:00
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00