示例#1
0
 def setUp(self):
     RuleTest.setUp(self)
     self.rule = ShellTimeout(self.config,
                              self.environ,
                              self.logdispatch,
                              self.statechglogger)
     self.rulename = self.rule.rulename
     self.rulenumber = self.rule.rulenumber
     self.ch = CommandHelper(self.logdispatch)
 def setUp(self):
     RuleTest.setUp(self)
     self.rule = ShellTimeout(self.config,
                              self.environ,
                              self.logdispatch,
                              self.statechglogger)
     self.rulename = self.rule.rulename
     self.rulenumber = self.rule.rulenumber
     self.ch = CommandHelper(self.logdispatch)
class zzzTestRuleShellTimeout(RuleTest):

    def setUp(self):
        RuleTest.setUp(self)
        self.rule = ShellTimeout(self.config,
                                 self.environ,
                                 self.logdispatch,
                                 self.statechglogger)
        self.rulename = self.rule.rulename
        self.rulenumber = self.rule.rulenumber
        self.ch = CommandHelper(self.logdispatch)

    def tearDown(self):
        pass

    def runTest(self):
        self.simpleRuleTest()

    def setConditionsForRule(self):
        '''
        Configure system for the unit test
        @param self: essential if you override this definition
        @return: boolean - If successful True; If failure False
        @author: Eric Ball
        '''
        datatype = "bool"
        key = "SHELLTIMEOUT"
        instructions = "To disable this rule set the value of " + \
                       "SHELLTIMEOUT to False."
        default = True
        self.rule.ci = self.rule.initCi(datatype, key, instructions, default)

        cmd = ["/bin/rm", "-f", "/etc/profile.d/tmout.sh"]
        success = self.ch.executeCommand(cmd)
        cmd = ["/bin/rm", "-f", "/etc/profile.d/autologout.csh"]
        success &= self.ch.executeCommand(cmd)
        return success

    def checkReportForRule(self, pCompliance, pRuleSuccess):
        '''
        check on whether report was correct
        @param self: essential if you override this definition
        @param pCompliance: the self.iscompliant value of rule
        @param pRuleSuccess: did report run successfully
        @return: boolean - If successful True; If failure False
        @author: ekkehard j. koch
        '''
        self.logdispatch.log(LogPriority.DEBUG, "pCompliance = " +
                             str(pCompliance) + ".")
        self.logdispatch.log(LogPriority.DEBUG, "pRuleSuccess = " +
                             str(pRuleSuccess) + ".")
        success = True
        return success

    def checkFixForRule(self, pRuleSuccess):
        '''
        check on whether fix was correct
        @param self: essential if you override this definition
        @param pRuleSuccess: did report run successfully
        @return: boolean - If successful True; If failure False
        @author: ekkehard j. koch
        '''
        self.logdispatch.log(LogPriority.DEBUG, "pRuleSuccess = " +
                             str(pRuleSuccess) + ".")
        success = True
        return success

    def checkUndoForRule(self, pRuleSuccess):
        '''
        check on whether undo was correct
        @param self: essential if you override this definition
        @param pRuleSuccess: did report run successfully
        @return: boolean - If successful True; If failure False
        @author: ekkehard j. koch
        '''
        self.logdispatch.log(LogPriority.DEBUG, "pRuleSuccess = " +
                             str(pRuleSuccess) + ".")
        success = True
        return success
示例#4
0
class zzzTestRuleShellTimeout(RuleTest):

    def setUp(self):
        RuleTest.setUp(self)
        self.rule = ShellTimeout(self.config,
                                 self.environ,
                                 self.logdispatch,
                                 self.statechglogger)
        self.rulename = self.rule.rulename
        self.rulenumber = self.rule.rulenumber
        self.ch = CommandHelper(self.logdispatch)

    def tearDown(self):
        pass

    def runTest(self):
        self.simpleRuleTest()

    def setConditionsForRule(self):
        '''Configure system for the unit test

        :param self: essential if you override this definition
        :returns: boolean - If successful True; If failure False
        @author: Eric Ball

        '''
        datatype = "bool"
        key = "SHELLTIMEOUT"
        instructions = "To disable this rule set the value of " + \
                       "SHELLTIMEOUT to False."
        default = True
        self.rule.ci = self.rule.initCi(datatype, key, instructions, default)

        cmd = ["/bin/rm", "-f", "/etc/profile.d/tmout.sh"]
        success = self.ch.executeCommand(cmd)
        cmd = ["/bin/rm", "-f", "/etc/profile.d/autologout.csh"]
        success &= self.ch.executeCommand(cmd)
        return success

    def checkReportForRule(self, pCompliance, pRuleSuccess):
        '''check on whether report was correct

        :param self: essential if you override this definition
        :param pCompliance: the self.iscompliant value of rule
        :param pRuleSuccess: did report run successfully
        :returns: boolean - If successful True; If failure False
        @author: ekkehard j. koch

        '''
        self.logdispatch.log(LogPriority.DEBUG, "pCompliance = " +
                             str(pCompliance) + ".")
        self.logdispatch.log(LogPriority.DEBUG, "pRuleSuccess = " +
                             str(pRuleSuccess) + ".")
        success = True
        return success

    def checkFixForRule(self, pRuleSuccess):
        '''check on whether fix was correct

        :param self: essential if you override this definition
        :param pRuleSuccess: did report run successfully
        :returns: boolean - If successful True; If failure False
        @author: ekkehard j. koch

        '''
        self.logdispatch.log(LogPriority.DEBUG, "pRuleSuccess = " +
                             str(pRuleSuccess) + ".")
        success = True
        return success

    def checkUndoForRule(self, pRuleSuccess):
        '''check on whether undo was correct

        :param self: essential if you override this definition
        :param pRuleSuccess: did report run successfully
        :returns: boolean - If successful True; If failure False
        @author: ekkehard j. koch

        '''
        self.logdispatch.log(LogPriority.DEBUG, "pRuleSuccess = " +
                             str(pRuleSuccess) + ".")
        success = True
        return success