Esempio n. 1
0
 def test_get_file(self):
     # rules
     result = get_file(
         os.path.join(os.getcwd(), 'tests/data/test_rules.xml'))
     self.assertIsInstance(result, str)
     # decoders
     result = get_file(
         os.path.join(os.getcwd(), 'tests/data/test_decoders.xml'))
     self.assertIsInstance(result, str)
     # CDB lists
     result = get_file(os.path.join(os.getcwd(), 'tests/data/test_lists'))
     self.assertIsInstance(result, str)
Esempio n. 2
0
def test_get_file(test_manager, input_file):
    input_file = getattr(test_manager, input_file)
    with open(os.path.join(test_data_path, input_file)) as f:
        xml_file = f.read()

    with patch('builtins.open', mock_open(read_data=xml_file)):
        result = get_file(input_file)
    assert result == xml_file