1
2async def test_mongo(service_client):
3 data = {
4 ('hello', 'ru', 'Привет'),
5 ('hello', 'en', 'hello'),
6 ('welcome', 'ru', 'Добро пожаловать'),
7 ('welcome', 'en', 'Welcome'),
8 }
9 for key, lang, value in data:
10 response = await service_client.patch(
11 '/v1/translations',
12 params={'key': key, 'lang': lang, 'value': value},
13 )
14 assert response.status == 201
15
16 response = await service_client.get('/v1/translations')
17 assert response.status_code == 200
18 assert 'application/json' in response.headers['Content-Type']
19 assert response.json()['content'] == {
20 'hello': {'en': 'hello', 'ru': 'Привет'},
21 'welcome': {'ru': 'Добро пожаловать', 'en': 'Welcome'},
22 }
23