|
5 | 5 | from typing import Dict, List |
6 | 6 | from uuid import UUID, uuid4 |
7 | 7 |
|
8 | | -from fastapi import APIRouter, FastAPI, status |
| 8 | +from fastapi import FastAPI, status |
9 | 9 | from httpx import AsyncClient |
10 | 10 | from pydantic import BaseModel, Field, root_validator, validator |
11 | 11 | from pytest import fixture, mark, param # noqa PT013 |
|
15 | 15 | from fastapi_jsonapi.exceptions import BadRequest |
16 | 16 | from fastapi_jsonapi.schema_builder import SchemaBuilder |
17 | 17 | from fastapi_jsonapi.views.view_base import ViewBase |
18 | | -from tests.fixtures.app import build_app_plain |
| 18 | +from tests.fixtures.app import build_app_custom |
19 | 19 | from tests.fixtures.entities import build_workplace, create_user |
20 | | -from tests.fixtures.views import DetailViewBaseGeneric, ListViewBaseGeneric |
21 | 20 | from tests.misc.utils import fake |
22 | 21 | from tests.models import ( |
23 | 22 | Computer, |
@@ -51,34 +50,6 @@ def association_key(data: dict): |
51 | 50 | return data["type"], data["id"] |
52 | 51 |
|
53 | 52 |
|
54 | | -def build_app_custom( |
55 | | - model, |
56 | | - schema, |
57 | | - schema_in_patch=None, |
58 | | - schema_in_post=None, |
59 | | - resource_type: str = "misc", |
60 | | -) -> FastAPI: |
61 | | - router: APIRouter = APIRouter() |
62 | | - |
63 | | - RoutersJSONAPI( |
64 | | - router=router, |
65 | | - path="/misc", |
66 | | - tags=["Misc"], |
67 | | - class_detail=DetailViewBaseGeneric, |
68 | | - class_list=ListViewBaseGeneric, |
69 | | - schema=schema, |
70 | | - resource_type=resource_type, |
71 | | - schema_in_patch=schema_in_patch, |
72 | | - schema_in_post=schema_in_post, |
73 | | - model=model, |
74 | | - ) |
75 | | - |
76 | | - app = build_app_plain() |
77 | | - app.include_router(router, prefix="") |
78 | | - |
79 | | - return app |
80 | | - |
81 | | - |
82 | 53 | async def test_root(client: AsyncClient): |
83 | 54 | response = await client.get("/docs") |
84 | 55 | assert response.status_code == status.HTTP_200_OK |
|
0 commit comments