Example #1
0
    def test_002_onMessage_update_alarm_ok(self):
        alarm_update = testData.ALARM_UPDATE

        alarm_before = AlarmDao.get_alarm(json.loads(alarm_update['data'])['id'], testData.burner)
        self.assertEquals(alarm_before['acknowledged'], 0)

        SyncManager.onMessage(alarm_update)

        alarm_after = AlarmDao.get_alarm(json.loads(alarm_update['data'])['id'], testData.burner)
        self.assertEquals(alarm_after['acknowledged'], 1)
Example #2
0
    def test_003_onMessage_delete_alarm_ok(self):
        alarm_delete = testData.ALARM_DELETE
        data = json.loads(alarm_delete['data'])

        alarm_before = AlarmDao.get_alarm(data['id'], testData.burner)
        self.assertIsNotNone(alarm_before)

        print(alarm_delete, (type(alarm_delete)))
        SyncManager.onMessage(alarm_delete)

        alarm_after = AlarmDao.get_alarm(data['id'], testData.burner)
        self.assertIsNone(alarm_after)
Example #3
0
    def test_010_alarm_trigger(self):
        AlarmDao.create_alarm(self.BURNER_ID, self.TYPE, "error")
        new_alarms = NewAlarmsDao.get_all()
        self.assertEqual(1, len(new_alarms))
        inserted = new_alarms[0]

        real_alarm = AlarmDao.get_alarm(inserted['alarm_id'], self.BURNER_ID)
        self.assertEqual(real_alarm['type_key'], self.TYPE)