Exemple #1
0
 def parse_config(self):
     """
     Transform config file into Pluggins acceptable list of enables and
     disables.
     """
     if 'CATEGORIES' in self.config:
         self.categories, self.disable_categories = \
             enables_disables(self.config['CATEGORIES'])
     if 'CHECKERS' in self.config:
         self.checkers, self.disable_checkers = \
             enables_disables(self.config['CHECKERS'])
     if 'MESSAGES' in self.config:
         self.messages, self.disable_messages = \
             enables_disables(self.config['MESSAGES'])
     namespace.validate_ids('message', self.messages)
     namespace.validate_ids('message', self.disable_messages)
     # handle_disable_categories should be called before handle_categories
     self.disable_categories = self._handle_disable_categories()
     # handle_categories should be called after handle_disable_categories
     self.categories = self._handle_categories()
     self.checkers = self._handle_checkers()
     self.disable_checkers = self._handle_disable_checkers()
     self.checkers_ids = [i[0] for i in self.checkers]
Exemple #2
0
 def test_validate_id(self):
     namespace.validate_ids('message', ['W1025'])
     namespace.validate_ids('checker', ['checker_validname'])
     namespace.validate_ids('category', ['ValidCategoryName'])
     with ShouldRaise(NameError("Id 'imValidCategoryName' is not allowed "
                                "for category")):
         namespace.validate_ids('category', ['imValidCategoryName'])
     with ShouldRaise(NameError("Id 'checker_Invalidname' is not allowed "
                                "for checker")):
         namespace.validate_ids('checker', ['checker_Invalidname'])
     with ShouldRaise(NameError("Id 'W10205' is not allowed for message")):
         namespace.validate_ids('message', ['W10205'])
Exemple #3
0
 def test_validate_id(self):
     namespace.validate_ids('message', ['W1025'])
     namespace.validate_ids('checker', ['checker_validname'])
     namespace.validate_ids('category', ['ValidCategoryName'])
     with ShouldRaise(
             NameError("Id 'imValidCategoryName' is not allowed "
                       "for category")):
         namespace.validate_ids('category', ['imValidCategoryName'])
     with ShouldRaise(
             NameError("Id 'checker_Invalidname' is not allowed "
                       "for checker")):
         namespace.validate_ids('checker', ['checker_Invalidname'])
     with ShouldRaise(NameError("Id 'W10205' is not allowed for message")):
         namespace.validate_ids('message', ['W10205'])