-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
34 lines (24 loc) · 943 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from zyte_test_websites.jobs.app import make_app as make_test_job_website
from zyte_test_websites.utils import get_default_data
from fake_zyte_api.main import make_app
if TYPE_CHECKING:
from aiohttp.pytest_plugin import AiohttpClient, AiohttpServer
from aiohttp.test_utils import TestClient, TestServer
from aiohttp.web import Application, Request
@pytest.fixture
async def api_server(aiohttp_server: AiohttpServer) -> TestServer:
app = make_app()
return await aiohttp_server(app)
@pytest.fixture
async def api_client(
aiohttp_client: AiohttpClient,
) -> TestClient[Request, Application]:
app = make_app()
return await aiohttp_client(app)
@pytest.fixture
async def jobs_website(aiohttp_server: AiohttpServer) -> TestServer:
app = make_test_job_website(get_default_data("jobs"))
return await aiohttp_server(app)