diff options
author | Frederick Muriuki Muriithi | 2022-11-09 11:52:49 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-11-09 11:57:49 +0300 |
commit | b8d33374ba4686fcadeed9f6c60f937f2eb19a89 (patch) | |
tree | c4300bd0908bc378ad15614caadcc5e6555bcb00 /tests/unit/auth/conftest.py | |
parent | e66ca1919381261a0fcdb744d1fc12e8f51739d8 (diff) | |
download | genenetwork3-b8d33374ba4686fcadeed9f6c60f937f2eb19a89.tar.gz |
Tests: Provide backend fixture to (apply|rollback)_single_migration
Diffstat (limited to 'tests/unit/auth/conftest.py')
-rw-r--r-- | tests/unit/auth/conftest.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/unit/auth/conftest.py b/tests/unit/auth/conftest.py index faecd32..b7e00bd 100644 --- a/tests/unit/auth/conftest.py +++ b/tests/unit/auth/conftest.py @@ -5,6 +5,7 @@ from typing import Union from contextlib import closing import pytest +from yoyo.backends import DatabaseBackend from yoyo import get_backend, read_migrations from yoyo.migrations import Migration, MigrationList @@ -20,13 +21,13 @@ def auth_migrations_dir(test_app_config): # pylint: disable=redefined-outer-name """Get the test application's auth database file""" return test_app_config["AUTH_MIGRATIONS"] -def apply_single_migration(db_uri: Union[Path, str], migration: Migration): +def apply_single_migration(backend: DatabaseBackend, migration: Migration): """Utility to apply a single migration""" - apply_migrations(get_backend(f"sqlite:///{db_uri}"), MigrationList([migration])) + apply_migrations(backend, MigrationList([migration])) -def rollback_single_migration(db_uri: Union[Path, str], migration: Migration): +def rollback_single_migration(backend: DatabaseBackend, migration: Migration): """Utility to rollback a single migration""" - rollback_migrations(get_backend(f"sqlite:///{db_uri}"), MigrationList([migration])) + rollback_migrations(backend, MigrationList([migration])) @pytest.fixture(scope="session") def backend(auth_testdb_path): # pylint: disable=redefined-outer-name |