6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 22:13:05 +01:00
firebird-qa/tests/functional/basic/isql/test_07.py

45 lines
1.6 KiB
Python

#coding:utf-8
"""
ID: issue-7425
ISSUE: https://github.com/FirebirdSQL/firebird/issues/7425
TITLE: Add REPLICA MODE to the output of the isql SHOW DATABASE command
DESCRIPTION:
NOTES:
[20.04.2023] pzotov
Currently avaliable only in Firebird-4.x. Waiting for frontport.
Checked on 4.0.3.2931
"""
import locale
import pytest
from firebird.qa import *
# QA_GLOBALS -- dict, is defined in qa/plugin.py, obtain settings
# from act.files_dir/'test_config.ini':
repl_settings = QA_GLOBALS['replication']
MAIN_DB_ALIAS = repl_settings['main_db_alias']
REPL_DB_ALIAS = repl_settings['repl_db_alias']
db_main = db_factory( filename = '#' + MAIN_DB_ALIAS, do_not_create = True, do_not_drop = True)
db_repl = db_factory( filename = '#' + REPL_DB_ALIAS, do_not_create = True, do_not_drop = True)
substitutions = [('^((?!(Replica mode:)).)*$', ''),]
act_db_main = python_act('db_main', substitutions = substitutions)
act_db_repl = python_act('db_repl', substitutions = substitutions)
#--------------------------------------------
@pytest.mark.version('>=4.0.3')
def test_1(act_db_main: Action, act_db_repl: Action, capsys):
if act_db_main.is_version('>=5'):
pytest.skip("Currently avaliable only in Firebird-4.x. Waiting for frontport.")
for a in (act_db_main, act_db_repl):
a.expected_stdout = 'Replica mode: ' + ('NONE' if a == act_db_main else 'READ_ONLY')
a.isql(switches=['-q', '-nod'], input = 'show database;', combine_output = True, io_enc = locale.getpreferredencoding())
assert a.clean_stdout == a.clean_expected_stdout
a.reset()