Passed
Push — master ( 0c27db...a79d09 )
by Mingyu
01:58
created

build.tests   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 22
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A BaseTestCase.request() 0 6 1
A BaseTestCase.setUp() 0 11 1
1
from unittest import TestCase
2
3
from flask.wrappers import Response
4
5
from app import create_app
6
from config.app_config import LocalLevelConfig
7
from config.db_config import LocalDBConfig
8
9
10
class BaseTestCase(TestCase):
11
    def setUp(self):
12
        self.app = create_app(LocalLevelConfig, LocalDBConfig)
13
        self.client = self.app.test_client()
14
15
        self.method = "GET"
16
        self.path = None
17
        self.path_parameters = dict()
18
19
        self.headers = dict()
20
        self.json = dict()
21
        self.query_string = dict()
22
23
    def request(self) -> Response:
24
        return self.client.open(
25
            method=self.method,
26
            path=self.path.format(**self.path_parameters),
27
            json=self.json,
28
            query_string=self.query_string,
29
        )
30