-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStratumTestCase.py
37 lines (28 loc) · 1.16 KB
/
StratumTestCase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import unittest
from io import StringIO
from pystratum_mysql.MySqlDefaultConnector import MySqlDefaultConnector
from test.TestDataLayer import TestDataLayer
class StratumTestCase(unittest.TestCase):
def __init__(self, method_name):
"""
Object constructor.
"""
super().__init__(method_name)
params = {'host': 'localhost',
'user': 'test',
'password': 'test',
'database': 'test'}
self._dl: TestDataLayer = TestDataLayer(MySqlDefaultConnector(params))
"""
The generated data layer.
"""
# ------------------------------------------------------------------------------------------------------------------
def setUp(self):
self._dl.connect()
self.held, sys.stdout = sys.stdout, StringIO()
# ------------------------------------------------------------------------------------------------------------------
def tearDown(self):
sys.stdout = self.held
self._dl.disconnect()
# ----------------------------------------------------------------------------------------------------------------------