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

33 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-22 21:59:15 +01:00
"""
ID: issue-4123
ISSUE: 4123
TITLE: Report OS user name in MON$ATTACHMENTS
DESCRIPTION:
We compare values in mon$attachment with those that can be obtained using pure Python calls (without FB).
NB: on Windows remote_os_user contains value in lower case ('zotov'), exact value was: 'Zotov'.
JIRA: CORE-3779
FBTEST: bugs.core_3779
2022-01-22 21:59:15 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-11-17 19:43:06 +01:00
import socket
import getpass
2022-01-22 21:59:15 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-22 21:59:15 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-22 21:59:15 +01:00
def test_1(act: Action):
with act.db.connect() as con:
2021-11-17 19:43:06 +01:00
c = con.cursor()
c.execute('select mon$remote_host, mon$remote_os_user from mon$attachments where mon$attachment_id=current_connection')
r = c.fetchone()
if r[0].upper() != socket.gethostname().upper():
pytest.fail(f'FAILED check remote_host: got "{r[0]}" instead of "{socket.gethostname()}"')
if r[1].upper() != getpass.getuser().upper():
pytest.fail(f'FAILED check remote_os_user: got "{r[1]}" instead of "{getpass.getuser()}"')