userver: samples/http_caching/tests/test_http_caching.py
Loading...
Searching...
No Matches
samples/http_caching/tests/test_http_caching.py
1# /// [Functional test]
2async def test_http_caching(service_client, translations, mocked_time):
3 response = await service_client.post(
4 '/samples/greet',
5 params={'username': 'дорогой разработчик'},
6 )
7 assert response.status == 200
8 assert 'text/plain' in response.headers['Content-Type']
9 assert response.text == 'Привет, дорогой разработчик! Добро пожаловать'
10
11 translations['hello']['ru'] = 'Приветище'
12
13 mocked_time.sleep(10)
14 await service_client.invalidate_caches()
15
16 response = await service_client.post(
17 '/samples/greet',
18 params={'username': 'дорогой разработчик'},
19 )
20 assert response.status == 200
21 assert 'text/plain' in response.headers['Content-Type']
22 assert response.text == 'Приветище, дорогой разработчик! Добро пожаловать'
23 # /// [Functional test]