mirror of
https://github.com/bckelley/tconnectsync.git
synced 2026-08-24 03:34:12 -05:00
fix old tests (will be removed/updated)
This commit is contained in:
@@ -52,7 +52,7 @@ class NightscoutEntry:
|
||||
data = {
|
||||
"eventType": BOLUS_EVENTTYPE,
|
||||
"created_at": created_at,
|
||||
"carbs": int(carbs) if carbs else None,
|
||||
"carbs": int(carbs) if carbs else 0,
|
||||
"insulin": float(bolus),
|
||||
"notes": notes,
|
||||
"enteredBy": ENTERED_BY,
|
||||
|
||||
@@ -22,7 +22,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"created_at": "2021-03-16 00:25:21-04:00",
|
||||
"carbs": None,
|
||||
"insulin": None,
|
||||
"enteredBy": "Pump (tconnectsync)"
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -41,7 +42,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"created_at": "2021-03-16 12:25:21-04:00",
|
||||
"carbs": None,
|
||||
"insulin": None,
|
||||
"enteredBy": "Pump (tconnectsync)"
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -57,7 +59,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"carbs": 45,
|
||||
"insulin": 7.5,
|
||||
"notes": "",
|
||||
"enteredBy": "Pump (tconnectsync)"
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -72,7 +75,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"carbs": 5,
|
||||
"insulin": 0.5,
|
||||
"notes": "",
|
||||
"enteredBy": "Pump (tconnectsync)"
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -92,7 +96,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"notes": "",
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"glucose": "123",
|
||||
"glucoseType": "Sensor"
|
||||
"glucoseType": "Sensor",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -111,26 +116,12 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"notes": "",
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"glucose": "150",
|
||||
"glucoseType": "Finger"
|
||||
"glucoseType": "Finger",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
def test_bolus_with_bg_invalid_type(self):
|
||||
self.assertRaises(InvalidBolusTypeException,
|
||||
NightscoutEntry.bolus,
|
||||
bolus=0.5,
|
||||
carbs=5,
|
||||
created_at="2021-03-16 12:25:21-04:00",
|
||||
bg="150")
|
||||
|
||||
self.assertRaises(InvalidBolusTypeException,
|
||||
NightscoutEntry.bolus,
|
||||
bolus=0.5,
|
||||
carbs=5,
|
||||
created_at="2021-03-16 12:25:21-04:00",
|
||||
bg="150",
|
||||
bg_type="")
|
||||
|
||||
self.assertRaises(InvalidBolusTypeException,
|
||||
NightscoutEntry.bolus,
|
||||
bolus=0.5,
|
||||
@@ -163,6 +154,7 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"date": 1635041834000,
|
||||
"dateString": "2021-10-23T22:17:14-0400",
|
||||
"device": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -176,7 +168,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"reason": "reason",
|
||||
"notes": "reason",
|
||||
"created_at": "2021-12-05T00:16:35.058Z",
|
||||
"enteredBy": "Pump (tconnectsync)"
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
@@ -190,7 +183,8 @@ class TestNightscoutEntry(unittest.TestCase):
|
||||
"reason": "reason",
|
||||
"notes": "reason",
|
||||
"created_at": "2021-12-05T00:16:35.058Z",
|
||||
"enteredBy": "Pump (tconnectsync)"
|
||||
"enteredBy": "Pump (tconnectsync)",
|
||||
"pump_event_id": ""
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ def _stub_last_uploaded_entry(eventType, time_start=None, time_end=None):
|
||||
class TestNsWritePumpEvents(unittest.TestCase):
|
||||
|
||||
SITE_CHANGE_EVENT = {'time': '2024-02-04 16:27:50-05:00', 'event_type': 'Site/Cartridge Change'}
|
||||
SITE_CHANGE_NS = {'created_at': '2024-02-04 16:27:50-05:00', 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Site Change', 'notes': 'Site/Cartridge Change','reason': 'Site/Cartridge Change'}
|
||||
SITE_CHANGE_NS = {'created_at': '2024-02-04 16:27:50-05:00', 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Site Change', 'notes': 'Site/Cartridge Change','reason': 'Site/Cartridge Change', 'pump_event_id': ''}
|
||||
def test_write_single_sitechange_event(self):
|
||||
nightscout = NightscoutApi()
|
||||
nightscout.last_uploaded_entry = _stub_last_uploaded_entry
|
||||
@@ -31,7 +31,7 @@ class TestNsWritePumpEvents(unittest.TestCase):
|
||||
}, dict(nightscout.uploaded_entries))
|
||||
|
||||
EMPTY_CART_EVENT = {'time': '2024-05-14 09:01:59-04:00', 'event_type': 'Empty Cartridge/Pump Shutdown'}
|
||||
EMPTY_CART_NS = {'created_at': '2024-05-14 09:01:59-04:00', 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Basal Suspension', 'notes': 'Empty Cartridge/Pump Shutdown', 'reason': 'Empty Cartridge/Pump Shutdown'}
|
||||
EMPTY_CART_NS = {'created_at': '2024-05-14 09:01:59-04:00', 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Basal Suspension', 'notes': 'Empty Cartridge/Pump Shutdown', 'reason': 'Empty Cartridge/Pump Shutdown', 'pump_event_id': ''}
|
||||
def test_write_single_emptycart_event(self):
|
||||
nightscout = NightscoutApi()
|
||||
nightscout.last_uploaded_entry = _stub_last_uploaded_entry
|
||||
@@ -46,7 +46,7 @@ class TestNsWritePumpEvents(unittest.TestCase):
|
||||
}, dict(nightscout.uploaded_entries))
|
||||
|
||||
USER_SUSPENDED_EVENT = {'time': '2024-02-05 09:48:22-05:00', 'event_type': 'User Suspended'}
|
||||
USER_SUSPENDED_NS = {'created_at': '2024-02-05 09:48:22-05:00', 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Basal Suspension', 'notes': 'User Suspended', 'reason': 'User Suspended'}
|
||||
USER_SUSPENDED_NS = {'created_at': '2024-02-05 09:48:22-05:00', 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Basal Suspension', 'notes': 'User Suspended', 'reason': 'User Suspended', 'pump_event_id': ''}
|
||||
def test_write_single_usersuspended_event(self):
|
||||
nightscout = NightscoutApi()
|
||||
nightscout.last_uploaded_entry = _stub_last_uploaded_entry
|
||||
@@ -61,9 +61,9 @@ class TestNsWritePumpEvents(unittest.TestCase):
|
||||
}, dict(nightscout.uploaded_entries))
|
||||
|
||||
EXERCISE_EVENT = {'time': '2024-03-10 08:53:20-04:00', 'duration_mins': 269.3833333333333, 'event_type': 'Exercise'}
|
||||
EXERCISE_NS = {'created_at': '2024-03-10 08:53:20-04:00', 'duration': 269.3833333333333, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Exercise', 'notes': 'Exercise', 'reason': 'Exercise'}
|
||||
EXERCISE_NS = {'created_at': '2024-03-10 08:53:20-04:00', 'duration': 269.3833333333333, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Exercise', 'notes': 'Exercise', 'reason': 'Exercise', 'pump_event_id': ''}
|
||||
EXERCISE_EXTENDED_EVENT = {'time': '2024-03-10 08:53:20-04:00', 'duration_mins': 585.8833333333333, 'event_type': 'Exercise'}
|
||||
EXERCISE_EXTENDED_NS = {'created_at': '2024-03-10 08:53:20-04:00', 'duration': 585.8833333333333, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Exercise', 'notes': 'Exercise', 'reason': 'Exercise'}
|
||||
EXERCISE_EXTENDED_NS = {'created_at': '2024-03-10 08:53:20-04:00', 'duration': 585.8833333333333, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Exercise', 'notes': 'Exercise', 'reason': 'Exercise', 'pump_event_id': ''}
|
||||
def test_write_exercise_events(self):
|
||||
nightscout = NightscoutApi()
|
||||
nightscout.last_uploaded_entry = _stub_last_uploaded_entry
|
||||
@@ -103,9 +103,9 @@ class TestNsWritePumpEvents(unittest.TestCase):
|
||||
}, dict(nightscout.uploaded_entries))
|
||||
|
||||
SLEEP_EVENT = {'time': '2024-02-07 00:00:19-05:00', 'duration_mins': 13.916666666666666, 'event_type': 'Sleep'}
|
||||
SLEEP_NS = {'created_at': '2024-02-07 00:00:19-05:00', 'duration': 13.916666666666666, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Sleep', 'notes': 'Sleep', 'reason': 'Sleep'}
|
||||
SLEEP_NS = {'created_at': '2024-02-07 00:00:19-05:00', 'duration': 13.916666666666666, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Sleep', 'notes': 'Sleep', 'reason': 'Sleep', 'pump_event_id': ''}
|
||||
SLEEP_EXTENDED_EVENT = {'time': '2024-02-07 00:00:19-05:00', 'duration_mins': 74.0, 'event_type': 'Sleep'}
|
||||
SLEEP_EXTENDED_NS = {'created_at': '2024-02-07 00:00:19-05:00', 'duration': 74.0, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Sleep', 'notes': 'Sleep', 'reason': 'Sleep'}
|
||||
SLEEP_EXTENDED_NS = {'created_at': '2024-02-07 00:00:19-05:00', 'duration': 74.0, 'enteredBy': 'Pump (tconnectsync)', 'eventType': 'Sleep', 'notes': 'Sleep', 'reason': 'Sleep', 'pump_event_id': ''}
|
||||
def test_write_sleep_events(self):
|
||||
nightscout = NightscoutApi()
|
||||
nightscout.last_uploaded_entry = _stub_last_uploaded_entry
|
||||
|
||||
Reference in New Issue
Block a user