cossacklabs / acra

Database security suite. Database proxy with field-level encryption, search through encrypted data, SQL injections prevention, intrusion detection, honeypots. Supports client-side and proxy-side ("transparent") encryption. SQL, NoSQL.
https://www.cossacklabs.com/acra/
Apache License 2.0
1.32k stars 128 forks source link

Declare tables on object level instead of class level #626

Closed Lagovas closed 1 year ago

Lagovas commented 1 year ago

During synchronizing acra-ee with new changes from acra-ce I met issues with table re-declaration into the base.metadata. Previously all our tests were placed in the tests/test.py and python evaluated classes only once. Now we have several files with test cases and test_common.py that have base test cases with the declaration of encryptor_table. In most cases, this class is evaluated only once and has all child classes in the same file, or it is imported by other classes that re-declare encryptor_table with extend_existing=True parameter for sa.Table statement. If we will introduce test_XX.py which imports test_type_aware.py, which uses base test cases from test_common.py and some of them declare encryptor_config on the class level then we should add extend_existing in the all child classes and keep in mind it. Or we can declare into the separate metadata objects (not into the global base.metadata) and clean up after test cases - delete all tables to allow create new one extended without name duplication errors.

Checklist