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

163 lines
5.2 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: new-database-13
TITLE: New DB - RDB$GENERATORS
DESCRIPTION: Check for correct content of RDB$GENERATORS in empty database.
NOTES:
[28.10.2015]
1. Removed from comparison values of RDB$SECURITY_CLASS because its values often differ in 3.0 recent builds.
2. Field rdb$description has been moved at the end of output (select) list.
3. Added query to select FIELDS list of table because main check does not use asterisk
and we have to know if DDL of table will have any changes in future.
"""
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()
2021-04-26 20:07:00 +02:00
2022-01-30 16:52:03 +01:00
test_script = """
2021-04-26 20:07:00 +02:00
set blob all;
set count on;
set list on;
-- Query for check whether fields list of table was changed:
select rf.rdb$field_name
from rdb$relation_fields rf
where rf.rdb$relation_name = upper('rdb$generators')
order by rf.rdb$field_name;
-- Main test query:
select
rdb$generator_id
,rdb$generator_name
,rdb$system_flag
,rdb$initial_value
,rdb$generator_increment
,rdb$owner_name
,rdb$description as gen_descr_blob_id
from rdb$generators g
order by g.rdb$generator_id;
"""
2021-04-26 20:07:00 +02:00
2022-01-30 16:52:03 +01:00
act = isql_act('db', test_script, substitutions=[('GEN_DESCR_BLOB_ID.*', '')])
2021-04-26 20:07:00 +02:00
2022-01-30 16:52:03 +01:00
expected_stdout = """
RDB$FIELD_NAME RDB$DESCRIPTION
2021-04-26 20:07:00 +02:00
RDB$FIELD_NAME RDB$GENERATOR_ID
RDB$FIELD_NAME RDB$GENERATOR_INCREMENT
RDB$FIELD_NAME RDB$GENERATOR_NAME
RDB$FIELD_NAME RDB$INITIAL_VALUE
RDB$FIELD_NAME RDB$OWNER_NAME
RDB$FIELD_NAME RDB$SECURITY_CLASS
RDB$FIELD_NAME RDB$SYSTEM_FLAG
Records affected: 8
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 1
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$SECURITY_CLASS
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID <null>
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 2
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME SQL$DEFAULT
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID <null>
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 3
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$PROCEDURES
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e0
Procedure ID
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 4
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$EXCEPTIONS
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e1
Exception ID
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 5
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$CONSTRAINT_NAME
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e2
Implicit constraint name
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 6
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$FIELD_NAME
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e3
Implicit domain name
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 7
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$INDEX_NAME
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e4
Implicit index name
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 8
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$TRIGGER_NAME
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e5
Implicit trigger name
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 9
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$BACKUP_HISTORY
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e6
Nbackup technology
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 10
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$FUNCTIONS
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e7
Function ID
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
RDB$GENERATOR_ID 11
2022-01-30 16:52:03 +01:00
RDB$GENERATOR_NAME RDB$GENERATOR_NAME
2021-04-26 20:07:00 +02:00
RDB$SYSTEM_FLAG 1
RDB$INITIAL_VALUE 0
RDB$GENERATOR_INCREMENT 0
2022-01-30 16:52:03 +01:00
RDB$OWNER_NAME SYSDBA
2021-04-26 20:07:00 +02:00
GEN_DESCR_BLOB_ID 14:1e8
Implicit generator name
2022-01-30 16:52:03 +01:00
2021-04-26 20:07:00 +02:00
Records affected: 11
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=3.0')
2022-01-30 16:52:03 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout