コード例 #1
0
 def test_ufwparser_register_command_none(self):
     '''Test UFWParser.register_command()'''
     parser = ufw.parser.UFWParser()
     c = ufw.parser.UFWCommandBasic('enable')
     c.command = None
     parser.register_command(c)
     self.assertTrue('basic' in parser.commands)
     self.assertTrue('basic' in parser.commands['basic'])
コード例 #2
0
    def test_ufwparser_register_command(self):
        '''Test UFWParser.register_command()'''
        parser = ufw.parser.UFWParser()
        c = ufw.parser.UFWCommandBasic('enable')
        parser.register_command(c)
        self.assertTrue('basic' in parser.commands)
        self.assertTrue('enable' in parser.commands['basic'])

        # Register an already existing command
        tests.unit.support.check_for_exception(self, ufw.common.UFWError, \
                                                   parser.register_command,
                                                   c)