Source code for minos.common.testing.database.factories.locks

from ....database import (
    DatabaseOperation,
    LockDatabaseOperationFactory,
)
from ..clients import (
    MockedDatabaseClient,
)
from ..operations import (
    MockedDatabaseOperation,
)


[docs]class MockedLockDatabaseOperationFactory(LockDatabaseOperationFactory): """For testing purposes"""
[docs] def build_acquire(self, hashed_key: int) -> DatabaseOperation: """For testing purposes""" return MockedDatabaseOperation("acquire")
[docs] def build_release(self, hashed_key: int) -> DatabaseOperation: """For testing purposes""" return MockedDatabaseOperation("release")
MockedDatabaseClient.set_factory(LockDatabaseOperationFactory, MockedLockDatabaseOperationFactory)