| Total Complexity | 2 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/env python3 |
||
| 2 | # -*- coding: utf-8 -*- |
||
| 3 | |||
| 4 | """Module documentation goes here.""" |
||
| 5 | |||
| 6 | import unittest |
||
| 7 | from dataclasses import dataclass |
||
| 8 | from src.things3_api import ThingsAPI, ThingsGUI |
||
| 9 | from src.things3 import Things3 |
||
| 10 | |||
| 11 | |||
| 12 | class Things3APICase(unittest.TestCase): |
||
| 13 | """Class documentation goes here.""" |
||
| 14 | |||
| 15 | things_api = ThingsAPI() |
||
| 16 | things_gui = ThingsGUI() |
||
| 17 | things_api.things3 = Things3(database='tests/Things.sqlite3') |
||
| 18 | @dataclass |
||
|
|
|||
| 19 | class Resp: |
||
| 20 | media: str |
||
| 21 | status: str |
||
| 22 | data: bytes |
||
| 23 | |||
| 24 | def test_today(self): |
||
| 25 | """Test Today.""" |
||
| 26 | |||
| 27 | resp = self.Resp("", "", None) |
||
| 28 | self.things_api.on_get(None, resp, "today") |
||
| 29 | self.assertEqual(1, len(resp.media)) |
||
| 30 | |||
| 31 | def test_get_file(self): |
||
| 32 | """Test get file.""" |
||
| 33 | |||
| 34 | resp = self.Resp("", "", None) |
||
| 35 | self.things_gui.on_get(None, resp, "/kanban.html") |
||
| 36 | self.assertIn("footer", resp.data.decode()) |
||
| 37 | |||
| 38 | if __name__ == '__main__': |
||
| 39 | unittest.main() |
||
| 40 |