userver: samples/postgres_service/tests/test_postgres.py
Loading...
Searching...
No Matches
samples/postgres_service/tests/test_postgres.py
1# /// [Functional test]
2async def test_postgres(service_client):
3 response = await service_client.delete('/v1/key-value?key=hello')
4 assert response.status == 200
5
6 response = await service_client.post('/v1/key-value?key=hello&value=world')
7 assert response.status == 201
8 assert response.content == b'world'
9
10 response = await service_client.get('/v1/key-value?key=hello')
11 assert response.status == 200
12 assert response.content == b'world'
13
14 response = await service_client.delete('/v1/key-value?key=hello')
15 assert response.status == 200
16
17 response = await service_client.post('/v1/key-value?key=hello&value=there')
18 assert response.status == 201
19 assert response.content == b'there'
20 # /// [Functional test]
21
22 response = await service_client.get('/v1/key-value?key=hello')
23 assert response.status == 200
24 assert response.content == b'there'
25
26 response = await service_client.post('/v1/key-value?key=hello&value=again')
27 assert response.status == 409
28 assert response.content == b'there'
29
30 response = await service_client.get('/v1/key-value?key=missing')
31 assert response.status == 404