2022-02-13 12:23:42 -09:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
|
|
|
from fastapi import Response
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
|
|
from mealie.repos.repository_factory import AllRepositories
|
|
|
|
|
|
|
|
|
|
|
|
class ABCMultiTenantTestCase(ABC):
|
|
|
|
def __init__(self, database: AllRepositories, client: TestClient) -> None:
|
|
|
|
self.database = database
|
|
|
|
self.client = client
|
2023-08-21 15:39:23 -05:00
|
|
|
self.items: list = []
|
2022-02-13 12:23:42 -09:00
|
|
|
|
|
|
|
@abstractmethod
|
2024-01-27 15:11:54 -06:00
|
|
|
def seed_action(self, group_id: str) -> set[int] | set[str]: ...
|
2022-02-13 12:23:42 -09:00
|
|
|
|
2023-08-21 15:39:23 -05:00
|
|
|
@abstractmethod
|
2024-01-27 15:11:54 -06:00
|
|
|
def seed_multi(self, group1_id: str, group2_id: str) -> tuple[set[str], set[str]]: ...
|
2022-02-13 12:23:42 -09:00
|
|
|
|
|
|
|
@abstractmethod
|
2024-01-27 15:11:54 -06:00
|
|
|
def get_all(self, token: str) -> Response: ...
|
2022-02-13 12:23:42 -09:00
|
|
|
|
|
|
|
@abstractmethod
|
2024-01-27 15:11:54 -06:00
|
|
|
def cleanup(self) -> None: ...
|
2022-02-13 12:23:42 -09:00
|
|
|
|
2024-08-12 17:09:30 +02:00
|
|
|
def __enter__(self): # noqa: B027
|
2022-02-13 12:23:42 -09:00
|
|
|
pass
|
|
|
|
|
|
|
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
|
|
self.cleanup()
|