| Total Complexity | 4 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """Unit test fixtures.""" |
||
| 2 | # pylint: disable=redefined-outer-name |
||
| 3 | |||
| 4 | import pytest |
||
| 5 | |||
| 6 | from kytos.core import Controller |
||
| 7 | from kytos.lib.helpers import get_controller_mock |
||
| 8 | |||
| 9 | |||
| 10 | @pytest.fixture(autouse=True) |
||
| 11 | def ev_loop(monkeypatch, event_loop) -> None: |
||
| 12 | """asyncio event loop autouse fixture.""" |
||
| 13 | monkeypatch.setattr("asyncio.get_running_loop", lambda: event_loop) |
||
| 14 | yield event_loop |
||
| 15 | |||
| 16 | |||
| 17 | @pytest.fixture |
||
| 18 | def controller() -> Controller: |
||
| 19 | """Controller fixture.""" |
||
| 20 | yield get_controller_mock() |
||
| 21 | |||
| 22 | |||
| 23 | @pytest.fixture |
||
| 24 | def api_client(controller): |
||
| 25 | """Flask app test_client instance.""" |
||
| 26 | yield controller.api_server.app.test_client() |
||
| 27 |