Passed
Push — master ( 602b7e...b49b41 )
by Mingyu
47s
created

tests.BaseTestCase.setUp()   A

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nop 1
dl 0
loc 11
rs 9.95
c 0
b 0
f 0
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