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

47 lines
1.9 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-26 21:10:46 +01:00
"""
ID: issue-6250
ISSUE: 6250
TITLE: gbak issues "Your user name and password are not defined" when command switch
"-fe(tch_password) ..." is specified when run as service
2022-01-26 21:10:46 +01:00
DESCRIPTION:
Test creates two files, one with correct SYSDBA password and second with invalid (hope that such password: T0t@1lywr0ng - is not in use for SYSDBA).
Also, test exports default SYSDBA password ('masterkey' ) to ISC_PASSWORD variable.
Then we do following:
1) "gbak -fe <invalid_password_file>" - this should FAIL with issuing "user name and password are not defined" in STDERR,
despite that ISC_USER is not empty and contains valid password
2) UNSET variable ISC_PASSWORD and run "gbak -fe <correct_password_file>" - this should PASS without any STDOUT or STDERR.
JIRA: CORE-6000
FBTEST: bugs.core_6000
2022-01-26 21:10:46 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-12-10 19:50:31 +01:00
import os
from pathlib import Path
2022-01-26 21:10:46 +01:00
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-26 21:10:46 +01:00
expected_stderr = """
2021-12-10 19:50:31 +01:00
gbak: ERROR:Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
gbak:Exiting before completion due to errors
"""
2021-04-26 20:07:00 +02:00
2021-12-10 19:50:31 +01:00
pwd_file = temp_file('pwd.dat')
fbk_file = temp_file('tmp_core_6000.fbk')
2021-04-26 20:07:00 +02:00
2021-12-10 19:50:31 +01:00
@pytest.mark.version('>=3.0.5')
2022-01-26 21:10:46 +01:00
def test_1(act: Action, pwd_file: Path, fbk_file: Path):
2021-12-10 19:50:31 +01:00
pwd_file.write_text('T0t@1lywr0ng')
2022-01-26 21:10:46 +01:00
with act.envar('ISC_PASSWORD', act.db.password):
act.expected_stderr = expected_stderr
act.gbak(switches=['-b', '-se', 'localhost:service_mgr', '-user', act.db.user,
'-fe', str(pwd_file), act.db.dsn, str(fbk_file)], credentials=False)
assert act.clean_stderr == act.clean_expected_stderr
pwd_file.write_text(act.db.password)
act.gbak(switches=['-b', '-se', 'localhost:service_mgr', '-user', act.db.user,
'-fe', str(pwd_file), act.db.dsn, str(fbk_file)], credentials=False)