-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_loops.py
61 lines (49 loc) · 2.41 KB
/
test_loops.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import unittest
from config import *
from tools import setup, transformation, test_bridge
SETUP = True
class UssTransformation(unittest.TestCase):
def test_loops(self):
"""
This test is passed if the algorithm works well in presence of loops, by checking whether the data into the
bridge are equal to the expected data
"""
schema = 'loops'
notes_file = 'notes/loops.sql'
columns = ['stage', '_key_phonecalls', '_key_emails', '_key_deals', '_key_employees', '_key_customers']
rows = [
['phonecalls', 1, None, None, 'Emp1', 'A'],
['phonecalls', 2, None, None, 'Emp1', 'A'],
['phonecalls', 3, None, None, 'Emp2', 'B'],
['phonecalls', 4, None, None, 'Emp2', 'B'],
['phonecalls', 5, None, None, 'Emp2', 'C'],
['emails', None, 1, None, 'Emp1', 'C'],
['emails', None, 2, None, 'Emp1', 'D'],
['emails', None, 3, None, 'Emp1', 'E'],
['emails', None, 4, None, 'Emp3', 'A'],
['deals', None, None, 1, 'Emp4', 'A'],
['deals', None, None, 2, 'Emp4', 'F'],
['deals', None, None, 3, 'Emp4', 'G'],
['employees', None, None, None, 'Emp1', None],
['employees', None, None, None, 'Emp2', None],
['employees', None, None, None, 'Emp3', None],
['employees', None, None, None, 'Emp4', None],
['employees', None, None, None, 'Emp5', None],
['employees', None, None, None, 'Emp6', None],
['customers', None, None, None, None, 'A'],
['customers', None, None, None, None, 'B'],
['customers', None, None, None, None, 'C'],
['customers', None, None, None, None, 'D'],
['customers', None, None, None, None, 'E'],
['customers', None, None, None, None, 'F'],
['customers', None, None, None, None, 'G'],
['customers', None, None, None, None, 'H'],
]
if SETUP:
setup(schema, DBNAME, PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, MINIO_HOST, MINIO_PORT, MINIO_USER,
MINIO_PASSWORD, TRINO_HOST, TRINO_PORT, TRINO_USER)
transformation(schema, TRINO_HOST, TRINO_PORT, TRINO_USER, notes_file)
is_equal = test_bridge(schema, TRINO_HOST, TRINO_PORT, TRINO_USER, columns, rows)
self.assertEqual(True, is_equal)
if __name__ == '__main__':
unittest.main()