6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-23 14:03:06 +01:00
firebird-qa/tests/functional/database/alter/test_02.py

33 lines
1.5 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-30 16:52:03 +01:00
"""
ID: alter-database-02
TITLE: Alter database: adding secondary file with alternate keyword
DESCRIPTION: Adding secondary file with alternate keyword for database.
"""
2021-04-26 20:07:00 +02:00
2022-01-30 16:52:03 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-30 16:52:03 +01:00
db = db_factory()
2022-01-30 16:52:03 +01:00
act = python_act('db', substitutions=[('^.*TEST.G', 'TEST.G'), ('[ ]+', '\t')])
2021-04-26 20:07:00 +02:00
2022-01-30 16:52:03 +01:00
expected_stdout = """CAST RDB$FILE_SEQUENCE RDB$FILE_START RDB$FILE_LENGTH
2021-04-26 20:07:00 +02:00
------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------- -------------- ---------------
C:\\JOB\\QA\\FBTEST\\TMP\\TEST.G00 1 10000 0
"""
2022-01-30 16:52:03 +01:00
@pytest.mark.version('>=3.0')
def test_1(act: Action, capsys):
with act.db.connect() as con:
with con.cursor() as c:
2022-01-30 16:52:03 +01:00
c.execute(f"ALTER SCHEMA ADD FILE '{act.db.db_path.with_name('TEST.G00')}' STARTING 10000")
con.commit()
c.execute("SELECT cast(RDB$FILE_NAME as varchar(150)),RDB$FILE_SEQUENCE,RDB$FILE_START,RDB$FILE_LENGTH FROM RDB$FILES")
2022-01-30 16:52:03 +01:00
act.print_data(c)
# Check
2022-01-30 16:52:03 +01:00
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
assert act.clean_stdout == act.clean_expected_stdout