Exemple #1
0
   def checkCreateErroneousRule(self, ruleName, ruleDescription, ruleCode, ruleLog):
      print '  Check notifications'
      notification.waitText(self.browser, notification.Type.Success, i18n.get()["modals"]["dashboard"]["sub-windows"]["automation-center"]["ruleSuccessfullyCreated"])
      notification.waitSubText(self.browser, notification.Type.Error, i18n.get()["eventLogger"]["RuleFailed"].replace("__who__", ruleName))
      
      print '  Check rule was inserted in rules table'
      rulesTable = dashboard.automation.waitRulesTableHasNRules(self.browser, 1)

      ruleNumber = 0
      
      print '  Check rule data in rules table'
      self.assertEqual(len(dashboard.automation.getRuleDatas(rulesTable, ruleNumber)), 5)
      self.assertEqual(dashboard.automation.getRuleName(rulesTable, ruleNumber), ruleName)
      self.assertEqual(dashboard.automation.getRuleDescription(rulesTable, ruleNumber), ruleDescription)
      self.assertTrue(dashboard.automation.getRuleAutoStart(rulesTable, ruleNumber))

      buttons = dashboard.automation.getRuleButtons(rulesTable, ruleNumber)
      self.assertEqual(len(buttons), 4)
      self.assertTrue(tools.waitUntil(lambda: dashboard.automation.getRuleStartStopButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-enableDisable btn-success"))
      self.assertEqual(dashboard.automation.getRuleEditButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-edit btn-primary")
      self.assertEqual(dashboard.automation.getRuleRemoveButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-delete btn-danger")
      
      self.assertTrue(tools.waitUntil(lambda: dashboard.automation.getRuleState(rulesTable, ruleNumber) == dashboard.automation.RuleState.Error))
      
      print '  Check rule was created on disk (corresponding script file)'
      self.assertTrue(scripts.checkLocalRuleCodeById(1, ruleCode))
      self.assertTrue(tools.waitUntil(lambda: scripts.checkLocalRuleLogById(1, ruleLog)))
Exemple #2
0
   def checkCreateErroneousRule(self, ruleName, ruleDescription, ruleCode, ruleLog):
      print ('  Check notifications')
      notification.waitText(self.browser, notification.Type.Success, i18n.get()["modals"]["dashboard"]["sub-windows"]["automation-center"]["ruleSuccessfullyCreated"])
      notification.waitSubText(self.browser, notification.Type.Error, i18n.get()["eventLogger"]["RuleFailed"].replace("{{who}}", ruleName))
      
      print ('  Check rule was inserted in rules table')
      rulesTable = dashboard.automation.waitRulesTableHasNRules(self.browser, 1)

      ruleNumber = 0
      
      print ('  Check rule data in rules table')
      self.assertEqual(len(dashboard.automation.getRuleDatas(rulesTable, ruleNumber)), 5)
      self.assertEqual(dashboard.automation.getRuleName(rulesTable, ruleNumber), ruleName)
      self.assertEqual(dashboard.automation.getRuleDescription(rulesTable, ruleNumber), ruleDescription)
      self.assertTrue(dashboard.automation.getRuleAutoStartState(rulesTable, ruleNumber))

      buttons = dashboard.automation.getRuleButtons(rulesTable, ruleNumber)
      self.assertEqual(len(buttons), 5)
      self.assertTrue(tools.waitUntil(lambda: dashboard.automation.getRuleStartStopButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-enableDisable btn-success"))
      self.assertEqual(dashboard.automation.getRuleStartStopButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-startStop btn-success")
      self.assertEqual(dashboard.automation.getRuleEditButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-edit btn-primary")
      self.assertEqual(dashboard.automation.getRuleDuplicateButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-duplicate btn-primary")
      self.assertEqual(dashboard.automation.getRuleRemoveButton(rulesTable, ruleNumber).get_attribute("class"), "btn btn-delete btn-danger")

      
      self.assertTrue(tools.waitUntil(lambda: dashboard.automation.getRuleState(rulesTable, ruleNumber) == dashboard.automation.RuleState.Error))
      
      print ('  Check rule was created on disk (corresponding script file)')
      self.assertTrue(scripts.checkLocalRuleCodeById(1, ruleCode))
      self.assertTrue(tools.waitUntil(lambda: scripts.checkLocalRuleLogById(1, ruleLog)))
Exemple #3
0
    def checkCreateOkRule(self, ruleName, ruleDescription, ruleCode, ruleLog):
        print '  Check notification'
        notification.waitText(
            self.browser, notification.Type.Success,
            i18n.get()["modals"]["dashboard"]["sub-windows"]
            ["automation-center"]["ruleSuccessfullyCreated"])

        print '  Check rule was inserted in rules table'
        rulesTable = dashboard.automation.waitRulesTableHasNRules(
            self.browser, 1)

        ruleNumber = 0

        print '  Check rule data in rules table'
        self.assertEqual(
            len(dashboard.automation.getRuleDatas(rulesTable, ruleNumber)), 5)
        self.assertEqual(
            dashboard.automation.getRuleName(rulesTable, ruleNumber), ruleName)
        self.assertEqual(
            dashboard.automation.getRuleDescription(rulesTable, ruleNumber),
            ruleDescription)
        self.assertTrue(
            dashboard.automation.getRuleAutoStart(rulesTable, ruleNumber))

        buttons = dashboard.automation.getRuleButtons(rulesTable, ruleNumber)
        self.assertEqual(len(buttons), 4)
        self.assertEqual(
            dashboard.automation.getRuleStartStopButton(
                rulesTable, ruleNumber).get_attribute("class"),
            "btn btn-startStop btn-warning")
        self.assertEqual(
            dashboard.automation.getRuleEditButton(
                rulesTable, ruleNumber).get_attribute("class"),
            "btn btn-edit btn-primary")
        self.assertEqual(
            dashboard.automation.getRuleRemoveButton(
                rulesTable, ruleNumber).get_attribute("class"),
            "btn btn-delete btn-danger")

        self.assertEqual(
            dashboard.automation.getRuleState(rulesTable, ruleNumber),
            dashboard.automation.RuleState.Running)

        print '  Check rule was created on disk (corresponding script file)'
        self.assertTrue(scripts.checkLocalRuleCodeById(1, ruleCode))
        self.assertTrue(
            tools.waitUntil(lambda: scripts.checkLocalRuleLogById(1, ruleLog)))