def test_parse_suspension_entry(self):
     self.assertEqual(
         TConnectEntry.parse_suspension_entry({
             "suspendReason": "control-iq",
             "continuation": None,
             "x": 1615879821
         }),
         {
             "time": "2021-03-16 00:30:21-04:00",
             "continuation": None,
             "suspendReason": "control-iq"
         }
     )
     self.assertEqual(
         TConnectEntry.parse_suspension_entry({
             "suspendReason": "control-iq",
             "continuation": "previous",
             "x": 1634022000
         }),
         {
             "time": "2021-10-12 00:00:00-04:00",
             "continuation": "previous",
             "suspendReason": "control-iq"
         }
     )
Exemple #2
0
    def test_process_ciq_basal_events_with_manual_suspension(self):
        data = TestBasalSync.get_example_ciq_basal_events_with_manual_suspension(
        )

        basalEvents = process_ciq_basal_events(data)
        self.assertEqual(len(basalEvents), 4)

        self.assertEqual(
            basalEvents[0],
            TConnectEntry.parse_ciq_basal_entry(
                data["basal"]["algorithmDeliveryEvents"][0],
                delivery_type="algorithmDelivery"))

        self.assertEqual(
            basalEvents[1],
            TConnectEntry.parse_ciq_basal_entry(
                data["basal"]["algorithmDeliveryEvents"][1],
                delivery_type="algorithmDelivery"))

        self.assertEqual(
            basalEvents[2],
            TConnectEntry.manual_suspension_to_basal_entry(
                TConnectEntry.parse_suspension_entry(
                    data["suspensionDeliveryEvents"][0]),
                seconds=2112,  # 2112 seconds between 12:07:35 and 12:42:47
            ))

        self.assertEqual(
            basalEvents[3],
            TConnectEntry.parse_ciq_basal_entry(
                data["basal"]["algorithmDeliveryEvents"][2],
                delivery_type="algorithmDelivery"))