Пример #1
0
 def test_which_message_oneof(self):
     payload = pb_util.build_payload("", 0, "", pb_util.mauka_pb2.MEASUREMENTS, [], 0, 0)
     self.assertEqual(pb_util.which_message_oneof(payload), pb_util.PAYLOAD)
     heartbeat = pb_util.build_heartbeat("", 0, 0, "", "")
     self.assertEqual(pb_util.which_message_oneof(heartbeat), pb_util.HEARTBEAT)
     makai_event = pb_util.build_makai_event("", 0)
     self.assertEqual(pb_util.which_message_oneof(makai_event), pb_util.MAKAI_EVENT)
     measurement = pb_util.build_measurement("", "", 0, 0, 0, 0)
     self.assertEqual(pb_util.which_message_oneof(measurement), pb_util.MEASUREMENT)
     makai_trigger = pb_util.build_makai_trigger("", 0, 0, "", 0, "")
     self.assertEqual(pb_util.which_message_oneof(makai_trigger), pb_util.MAKAI_TRIGGER)
     laha_ttl = pb_util.build_ttl("", "", 0)
     self.assertEqual(pb_util.which_message_oneof(laha_ttl), pb_util.LAHA)
     laha_gc_trigger = pb_util.build_gc_trigger("", [])
     self.assertEqual(pb_util.which_message_oneof(laha_gc_trigger), pb_util.LAHA)
     laha_gc_update = pb_util.build_gc_update("", pb_util.mauka_pb2.MEASUREMENTS, 0)
     self.assertEqual(pb_util.which_message_oneof(laha_gc_update), pb_util.LAHA)
     laha_gc_stat = pb_util.build_gc_stat("", pb_util.mauka_pb2.MEASUREMENTS, 0)
     self.assertEqual(pb_util.which_message_oneof(laha_gc_stat), pb_util.LAHA)
     trigger_request = pb_util.build_trigger_request("", 0, 0, [], 0)
     self.assertEqual(pb_util.which_message_oneof(trigger_request), pb_util.TRIGGER_REQUEST)
     triggered_event = pb_util.build_triggered_event("", [], 0, "", 0, 0)
     self.assertEqual(pb_util.which_message_oneof(triggered_event), pb_util.TRIGGERED_EVENT)
     threshold_optimization_request = pb_util.build_threshold_optimization_request("")
     self.assertEqual(pb_util.which_message_oneof(threshold_optimization_request), pb_util.THRESHOLD_OPTIMIZATION_REQUEST)
     box_optimization_request = pb_util.build_box_optimization_request("", [], 0)
     self.assertEqual(pb_util.which_message_oneof(box_optimization_request), pb_util.BOX_OPTIMIZATION_REQUEST)
Пример #2
0
 def test_build_makai_event(self):
     mauka_message = pb_util.build_makai_event("test", 1)
     self.assertTrue(isinstance(mauka_message, pb_util.mauka_pb2.MaukaMessage))
     self.assertTrue(pb_util.is_makai_event_message(mauka_message))
     self.assertEqual(mauka_message.source, "test")
     self.assertEqual(mauka_message.makai_event.event_id, 1)
Пример #3
0
 def test_is_box_optimization_request(self):
     mauka_message = pb_util.build_box_optimization_request("", [], 0)
     other_message = pb_util.build_makai_event("", 0)
     self.assertTrue(pb_util.is_box_optimization_request(mauka_message))
     self.assertFalse(pb_util.is_box_optimization_request(other_message))
Пример #4
0
 def test_is_triggered_event(self):
     mauka_message = pb_util.build_triggered_event("", [], 0, "", 0, 0)
     other_message = pb_util.build_makai_event("", 0)
     self.assertTrue(pb_util.is_triggered_event(mauka_message))
     self.assertFalse(pb_util.is_triggered_event(other_message))
Пример #5
0
 def test_is_measurement(self):
     mauka_message = pb_util.build_measurement("", "", 0, 0, 0, 0)
     other_message = pb_util.build_makai_event("", 0)
     self.assertTrue(pb_util.is_measurement(mauka_message))
     self.assertFalse(pb_util.is_measurement(other_message))
Пример #6
0
 def test_is_makai_event_message(self):
     mauka_message = pb_util.build_makai_event("", 0)
     other_message = pb_util.build_heartbeat("", 0, 0, "", "")
     self.assertTrue(pb_util.is_makai_event_message(mauka_message))
     self.assertFalse(pb_util.is_makai_event_message(other_message))