コード例 #1
0
    def test_get_section_dict(self):
        """
        Validates if the complete section can be collected ina python format
        """
        section_1 = ConfReader.get_section_dict('SECTION_1')
        self.assertTrue(isinstance(section_1, dict))

        section_2 = ConfReader.get_section_dict('SECTION_2')
        self.assertTrue(isinstance(section_2, dict))
        self.assertTrue(isinstance(section_2.get('config_6'), dict))
        self.assertTrue(isinstance(section_2.get('config_5'), list))
コード例 #2
0
 def test_invalid_sections(self):
     """
     Validates if NoSectionError is raised when the section is not available,
     both on the get and get as dict
     """
     self.assertRaises(NoSectionError,
                       lambda: ConfReader.get('SECTION_X', 'config_x'))
     self.assertRaises(NoSectionError,
                       lambda: ConfReader.get_section_dict('SECTION_X'))