test_endpoints   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_client_async() 0 14 1
1
from tests.test_client.queries.good_queries import good_queries
2
from tests.test_client.queries.bad_queries import bad_queries
3
from yfrake import client
4
import asyncio
5
import pytest
6
import sys
7
8
9
if sys.platform == 'win32':
10
    asyncio.set_event_loop_policy(
11
        asyncio.WindowsSelectorEventLoopPolicy()
12
    )
13
14
15
test_queries = good_queries + bad_queries
16
17
18
@pytest.mark.parametrize('args', test_queries)
19
async def test_client_async(args):
20
    @client.session
21
    async def inner():
22
        query = args.get('query')
23
        endpoint = query.get('endpoint')
24
25
        resp = client.get(**query)
26
        await resp.wait()
27
28
        assert resp.endpoint == endpoint
29
        assert bool(resp.error) is args.get('expected_error')
30
        assert bool(resp.data) is args.get('expected_data')
31
    await inner()
32