userver: samples/hello_service/tests/test_hello.py
Loading...
Searching...
No Matches
samples/hello_service/tests/test_hello.py
1# /// [Functional test]
2async def test_hello_base(service_client):
3 response = await service_client.get('/hello')
4 assert response.status == 200
5 assert response.content == b'Hello world!\n'
6 assert 'X-RequestId' not in response.headers.keys(), 'Unexpected header'
7 # /// [Functional test]
8
9
10async def test_hello_head(service_client):
11 response = await service_client.request('HEAD', '/hello')
12 assert response.status == 200
13 assert response.content == b''
14 assert 'X-RequestId' not in response.headers.keys(), 'Unexpected header'
15
16
17async def test_wrong_method(service_client):
18 response = await service_client.request('KEK', '/hello')
19 assert response.status == 400
20 assert response.content == b'bad request'
21 assert 'X-YaRequestId' not in response.headers.keys(), 'Unexpected header'