Completed
Push — master ( a29c3e...00153b )
by Dave
01:10
created

tests.test_app.TestApp.test_app_json_serialize()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
import unittest
2
from backend.fcmapp import ApplicationService
3
from domain.mining import AvailablePool
4
from messaging.schema import AvailablePoolSchema
5
6
class TestApp(unittest.TestCase):
7
    def test_app_json_serialize(self):
8
        app = ApplicationService(component='test')
9
        pool = AvailablePool('S9', None, 'url', 'user', 'x', 0)
10
        strpool = app.jsonserialize(AvailablePoolSchema(), pool)
11
        self.assertTrue(isinstance(strpool, str))
12
        self.assertFalse(strpool.startswith('['))
13
14
    def test_app_knownpools(self):
15
        app = ApplicationService(component='test')
16
        app.startup()
17
        pools = app.knownpools()
18
        self.assertTrue(len(pools) > 0)
19
        for pool in pools:
20
            self.assertTrue(isinstance(pool, AvailablePool))
21
22
if __name__ == '__main__':
23
    unittest.main()
24