Passed
Pull Request — master (#375)
by Vinicius
08:19
created

tests.conftest.ev_loop()   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
"""Unit test fixtures."""
2
# pylint: disable=redefined-outer-name
3
4 1
import pytest
5 1
from httpx import AsyncClient
6
7 1
from kytos.core import Controller
8 1
from kytos.core.auth import Auth
9 1
from kytos.core.dead_letter import DeadLetter
10 1
from kytos.lib.helpers import get_controller_mock
11
12
13 1
@pytest.fixture
14 1
def controller() -> Controller:
15
    """Controller fixture."""
16 1
    yield get_controller_mock()
17
18
19 1
@pytest.fixture
20 1
def dead_letter(controller) -> DeadLetter:
21
    """DeadLetter fixture."""
22 1
    yield controller.dead_letter
23
24
25 1
@pytest.fixture
26 1
def api_client(controller) -> AsyncClient:
27
    """App test_client instance."""
28 1
    base_url = "http://127.0.0.1/api/"
29 1
    app = controller.api_server.app
30 1
    yield AsyncClient(app=app, base_url=base_url)
31
32
33 1
@pytest.fixture
34 1
def auth(controller) -> Auth:
35
    """Auth fixture."""
36 1
    auth = Auth(controller)
37 1
    controller.start_auth()
38 1
    yield auth
39
40
41 1
@pytest.fixture
42 1
def minimal_openapi_spec_dict():
43
    """Sample minimal openapi spec."""
44 1
    return {
45
        "openapi": "3.0.0",
46
        "info": {"title": "Minimal OpenAPI specification", "version": "0.1"},
47
        "paths": {
48
            "/status": {
49
                "get": {
50
                    "responses": {"default": {"description": "status"}}
51
                }
52
            }
53
        },
54
    }
55