Ejemplo n.º 1
0
class TestProcessModel(unittest.TestCase):
    def setUp(self):
        self.model = ProcessModel()

    def test_get_process_data(self):

        active_checks = ['cron']
        cron = self.model.mongo.get_collection('cron')
        cron.remove()

        cron.insert({"memory": "10.8", "time": two_minutes_ago, "cpu": "0.0"})
        cron.insert({"memory": "10.8", "time": minute_ago, "cpu": "0.0"})
        cron.insert({"memory": "10.8", "time": now, "cpu": "0.0"})

        result = self.model.get_process_data(active_checks, two_minutes_ago,
                                             now)
        eq_(result['cron'].count(), 3)

        result = self.model.get_process_data(active_checks, minute_ago, now)
        eq_(result['cron'].count(), 2)

        cron.remove()
Ejemplo n.º 2
0
class TestProcessModel(unittest.TestCase):

    def setUp(self):
        self.model = ProcessModel()

    def test_get_process_data(self):
        
        active_checks = ['cron']
        cron = self.model.mongo.get_collection('cron')
        cron.remove()
        
        cron.insert({"memory" : "10.8", "time" : two_minutes_ago, "cpu" : "0.0" })
        cron.insert({"memory" : "10.8", "time" : minute_ago, "cpu" : "0.0" })
        cron.insert({"memory" : "10.8", "time" : now, "cpu" : "0.0" })


        result = self.model.get_process_data(active_checks, two_minutes_ago, now)
        eq_(result['cron'].count(), 3)


        result = self.model.get_process_data(active_checks, minute_ago, now)
        eq_(result['cron'].count(), 2)

        cron.remove()
Ejemplo n.º 3
0
 def setUp(self):
     self.model = ProcessModel()
Ejemplo n.º 4
0
 def setUp(self):
     self.model = ProcessModel()