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

TestDataManipulation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestDataManipulator.test_add_value_to_dictionary() 0 13 3
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