-
Notifications
You must be signed in to change notification settings - Fork 835
/
test_aiohttp_version_checker.py
42 lines (32 loc) · 1.32 KB
/
test_aiohttp_version_checker.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
import logging
import unittest
from slack_sdk.aiohttp_version_checker import validate_aiohttp_version
class TestAiohttpVersionChecker(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger(__name__)
def tearDown(self):
pass
def test_not_recommended_versions(self):
state = {"counter": 0}
def print(message: str):
state["counter"] = state["counter"] + 1
validate_aiohttp_version("2.1.3", print)
self.assertEqual(state["counter"], 1)
validate_aiohttp_version("3.6.3", print)
self.assertEqual(state["counter"], 2)
validate_aiohttp_version("3.7.0", print)
self.assertEqual(state["counter"], 3)
def test_recommended_versions(self):
state = {"counter": 0}
def print(message: str):
state["counter"] = state["counter"] + 1
validate_aiohttp_version("3.7.1", print)
self.assertEqual(state["counter"], 0)
validate_aiohttp_version("3.7.3", print)
self.assertEqual(state["counter"], 0)
validate_aiohttp_version("3.8.0", print)
self.assertEqual(state["counter"], 0)
validate_aiohttp_version("4.0.0", print)
self.assertEqual(state["counter"], 0)
validate_aiohttp_version("4.0.0rc1", print)
self.assertEqual(state["counter"], 0)