3c2744a3da
* add basic pre-commit file * add flake8 * add isort * add pep585-upgrade (typing upgrades) * use namespace for import * add mypy * update ci for backend * flake8 scope * fix version format * update makefile * disable strict option (temporary) * fix mypy issues * upgrade type hints (pre-commit) * add vscode typing check * add types to dev deps * remote container draft * update setup script * update compose version * run setup on create * dev containers update * remove unused pages * update setup tips * expose ports * Update pre-commit to include flask8-print (#1053) * Add in flake8-print to pre-commit * pin version of flake8-print * formatting * update getting strated docs * add mypy to pre-commit * purge .mypy_cache on clean * drop mypy Co-authored-by: zackbcom <zackbcom@users.noreply.github.com>
34 lines
840 B
Python
34 lines
840 B
Python
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
|
|
self.items = []
|
|
|
|
@abstractmethod
|
|
def seed_action(repos: AllRepositories, group_id: str) -> set[int] | set[str]:
|
|
...
|
|
|
|
def seed_multi(self, group1_id: str, group2_id: str) -> tuple[set[int], set[int]]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_all(token: str) -> Response:
|
|
...
|
|
|
|
@abstractmethod
|
|
def cleanup(self) -> None:
|
|
...
|
|
|
|
def __enter__(self):
|
|
pass
|
|
|
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
self.cleanup()
|