Passed
Push — master ( 622bd5...daf764 )
by Mingyu
57s
created

BaseTestCase.request()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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