6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_4224_test.py

35 lines
869 B
Python
Raw Permalink Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-23 20:41:55 +01:00
"""
ID: issue-4548
ISSUE: 4548
TITLE: Database replace through services API fails
DESCRIPTION:
JIRA: CORE-4224
FBTEST: bugs.core_4224
2022-01-23 20:41:55 +01:00
"""
2021-04-26 20:07:00 +02:00
import pytest
2021-11-18 20:15:37 +01:00
import os
from io import BytesIO
2022-01-23 20:41:55 +01:00
from firebird.qa import *
2021-11-18 20:15:37 +01:00
from firebird.driver import SrvRestoreFlag
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
db = db_factory()
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
act = python_act('db')
2021-04-26 20:07:00 +02:00
2022-01-23 20:41:55 +01:00
@pytest.mark.version('>=3')
def test_1(act: Action):
src_timestamp1 = os.path.getmtime(act.db.db_path)
2021-11-18 20:15:37 +01:00
backup = BytesIO()
2022-01-23 20:41:55 +01:00
with act.connect_server() as srv:
srv.database.local_backup(database=act.db.db_path, backup_stream=backup)
2021-11-18 20:15:37 +01:00
backup.seek(0)
2022-01-23 20:41:55 +01:00
srv.database.local_restore(database=act.db.db_path, backup_stream=backup,
2021-11-18 20:15:37 +01:00
flags=SrvRestoreFlag.REPLACE)
2022-01-23 20:41:55 +01:00
src_timestamp2 = os.path.getmtime(act.db.db_path)
2021-11-18 20:15:37 +01:00
assert src_timestamp2 - src_timestamp1 > 0
2021-04-26 20:07:00 +02:00