Beispiel #1
0
 def load(self):
     self.json_data = open(self.path)
     self.data = json.load(self.json_data)
     # Loop over the items and put into list
     metricItems = self.data["items"]
     for i in metricItems:
         item = MetricItem()
         item.setName(str(i["name"]))
         item.setPollingInterval(int(i["pollInterval"]))
         item.setCommand(str(i["command"]))
         item.setDebug(bool(i["debug"]))
         self.config.append(item)
Beispiel #2
0
 def testCommand(self):
     m = MetricItem()
     m.setCommand("snafu")
     self.assertEquals(m.getCommand(), "snafu", "Commands not equal")
Beispiel #3
0
 def testPollInterval(self):
     m = MetricItem()
     m.setDebug(True)
     self.assertEquals(m.getDebug(), True, "Debug not equal")
Beispiel #4
0
 def testPollIntervalType(self):
     m = MetricItem()
     m.setPollingInterval(1000)
     self.assertTrue(type(m.getPollingInterval()) == int)
Beispiel #5
0
 def testPollInterval(self):
     m = MetricItem()
     m.setPollingInterval(100)
     self.assertEquals(m.getPollingInterval(), 100, "Poll intervals not equal")
Beispiel #6
0
 def testNameType(self):
     m = MetricItem()
     m.setName("foo")
     self.assertTrue(type(m.getName()) == str, "Name is not a string")
Beispiel #7
0
 def testName(self):
     m = MetricItem()
     m.setName("foo")
     self.assertEquals(m.getName(), "foo", "Names not equal")