Passed
Push — development/test ( c39db9...ec5267 )
by Daniel
01:13
created

TestDataManipulator.test_add_value_to_dictionary()   A

Complexity

Conditions 3

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

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