-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
29 lines (23 loc) · 1.25 KB
/
tests.py
File metadata and controls
29 lines (23 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import unittest
import requests
class TestAPI(unittest.TestCase):
def test_count(self):
# Отправляем GET запрос на метод count
response = requests.get('http://localhost:8080/count?from=2022-01-01T00:00:00&to=2022-12-31T23:59:59')
# Проверяем, что ответ корректный
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json()['count'], int)
def test_mean(self):
# Отправляем GET запрос на метод mean
response = requests.get('http://localhost:8080/mean?from=2022-01-01T00:00:00&to=2022-12-31T23:59:59')
# Проверяем, что ответ корректный
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json()['value'], float)
def test_max(self):
# Отправляем GET запрос на метод max
response = requests.get('http://localhost:8080/max?from=2022-01-01T00:00:00&to=2022-12-31T23:59:59')
# Проверяем, что ответ корректный
self.assertEqual(response.status_code, 200)
self.assertIsInstance(response.json()['value'], float)
if __name__ == '__main__':
unittest.main()