Passed
Push — master ( b8b83a...5e3ba6 )
by Alexander
01:18
created

tests.test_things3_api   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 24
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Things3APICase.test_get_file() 0 6 1
A Things3APICase.test_today() 0 6 1
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
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
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