| Total Complexity | 5 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import unittest |
||
| 2 | import datetime |
||
| 3 | import backend.fcmutils as utils |
||
| 4 | import messaging.schema as schema |
||
| 5 | |||
| 6 | class TestUtilityFunctions(unittest.TestCase): |
||
| 7 | def test_safe_string_null(self): |
||
| 8 | nullstring = utils.safestring(None) |
||
| 9 | self.assertFalse(nullstring) |
||
| 10 | |||
| 11 | def test_safe_string_other(self): |
||
| 12 | astring = utils.safestring(b'test') |
||
| 13 | self.assertTrue(astring) |
||
| 14 | |||
| 15 | def test_formattime(self): |
||
| 16 | s = utils.formattime(datetime.datetime.now()) |
||
| 17 | self.assertTrue(s) |
||
| 18 | |||
| 19 | def test_deserializelist(self): |
||
| 20 | thelist = ['{"miner_type":"test", "minerid":"test"}'] |
||
| 21 | s = utils.deserializelist_withschema(schema.MinerInfoSchema(), thelist) |
||
| 22 | self.assertTrue(len(s) > 0) |
||
| 23 | |||
| 24 | def test_deserializelist_string(self): |
||
| 25 | thelist = ['{"miner_type":"test", "minerid":"test"}'] |
||
| 26 | s = utils.deserializelistofstrings(thelist, schema.MinerInfoSchema()) |
||
| 27 | self.assertTrue(len(s) > 0) |
||
| 28 |