# retoor from molodetz.constants import REPORTABLE_TARGETS, SOFT_DELETE_TABLES, UNREPORTABLE_TABLES from molodetz.docs_api import all_endpoints from molodetz.docs_api.registry import TARGET_TYPES def test_soft_delete_tables_partition(): tables = set(SOFT_DELETE_TABLES) assert tables == set(REPORTABLE_TARGETS) | set(UNREPORTABLE_TABLES) assert not set(REPORTABLE_TARGETS) & set(UNREPORTABLE_TABLES) def test_documented_endpoints_are_unique(): keys = [(item["method"], item["path"]) for item in all_endpoints()] assert len(keys) == len(set(keys)) def test_documented_endpoints_exist_in_app(): from molodetz.main import app routes = {(method.upper(), path) for path, methods in app.openapi()["paths"].items() for method in methods} missing = [(item["method"], item["path"]) for item in all_endpoints() if (item["method"], item["path"]) not in routes] assert missing == [] def test_target_types_known(): assert set(TARGET_TYPES) == {"post", "join_request", "user"} def test_no_oauth_redirect_route(): from molodetz.main import app assert "/docs/oauth2-redirect" not in app.openapi()["paths"] assert app.swagger_ui_oauth2_redirect_url is None