Total Complexity | 3 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from sources.common.DataManipulator import DataManipulator |
||
2 | from sources.common.FileOperations import FileOperations |
||
3 | # package to facilitate multiple operation system operations |
||
4 | import unittest |
||
5 | |||
6 | |||
7 | class TestDataManipulator(unittest.TestCase): |
||
8 | |||
9 | def test_add_value_to_dictionary(self): |
||
10 | fo = FileOperations() |
||
11 | # load testing values from JSON file |
||
12 | # where all cases are grouped |
||
13 | json_structure = fo.fn_open_file_and_get_content('dict_to_test.json') |
||
14 | c_dm = DataManipulator() |
||
15 | for add_type in json_structure: |
||
16 | if 'reference' not in json_structure[add_type]: |
||
17 | json_structure[add_type]['reference'] = None |
||
18 | given = c_dm.add_value_to_dictionary(json_structure[add_type]['list'], |
||
19 | json_structure[add_type]['add'], add_type, |
||
20 | json_structure[add_type]['reference']) |
||
21 | self.assertEqual(given, json_structure[add_type]['expected']) |
||
22 |