userver: /data/code/userver/libraries/easy/samples/3_json/testsuite/test_basic.py Source File
Loading...
Searching...
No Matches
test_basic.py
1async def test_kv(service_client):
2 response = await service_client.post(
3 '/kv', json={'key': 1, 'value': 'one'},
4 )
5 assert response.status == 200
6 assert response.json() is None
7 assert 'application/json' in response.headers['Content-Type']
8
9 response = await service_client.get('/kv', json={'key': 1})
10 assert response.status == 200
11 assert response.json() == {'key': 1, 'value': 'one'}
12 assert 'application/json' in response.headers['Content-Type']
13
14 response = await service_client.post(
15 '/kv', json={'key': 1, 'value': 'again_1'},
16 )
17 assert response.status == 200
18
19 response = await service_client.get('/kv', json={'key': 1})
20 assert response.status == 200
21 assert response.json() == {'key': 1, 'value': 'again_1'}
22 assert 'application/json' in response.headers['Content-Type']