userver: samples/http_caching/tests/test_http_caching.py
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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', params={'username': 'дорогой разработчик'},
5 )
6 assert response.status == 200
7 assert response.text == 'Привет, дорогой разработчик! Добро пожаловать'
8
9 translations['hello']['ru'] = 'Приветище'
10
11 mocked_time.sleep(10)
12 await service_client.invalidate_caches()
13
14 response = await service_client.post(
15 '/samples/greet', params={'username': 'дорогой разработчик'},
16 )
17 assert response.status == 200
18 assert response.text == 'Приветище, дорогой разработчик! Добро пожаловать'
19 # /// [Functional test]