-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
58 lines (39 loc) · 1.43 KB
/
test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import unittest
import requests
from version_rss_api import WordpressPlugin, SignalCliPlugin
class WordpressPluginTestCase(unittest.TestCase):
def tearDown(self) -> None:
self.OUT.session.close()
def setUp(self) -> None:
self.OUT = WordpressPlugin('TestUserAgent')
def test_instantiate(self):
self.assertTrue(self.OUT)
def test_getVersion(self):
version = self.OUT()
self.assertTrue(version)
self.assertTrue(isinstance(version, str))
class SignalCliTestCase(unittest.TestCase):
def tearDown(self) -> None:
self.OUT.session.close()
def setUp(self) -> None:
self.OUT = SignalCliPlugin('TestUserAgent')
def test_instantiate(self):
self.assertTrue(self.OUT)
def test_getVersion(self):
version = self.OUT()
self.assertTrue(version)
self.assertTrue(isinstance(version, str))
class ApiTestCase(unittest.TestCase):
BASE_URL = os.environ.get('BASE_URL', 'http://127.0.0.1:5000')
def setUp(self) -> None:
self.session = requests.Session()
def tearDown(self) -> None:
self.session.close()
def test_all(self):
response = self.session.get(F'{self.BASE_URL}/v1/most_recent')
response.raise_for_status()
self.assertTrue('signal-cli' in response.json().keys())
self.assertTrue('wordpress' in response.json().keys())
if __name__ == '__main__':
unittest.main()