@@ -90,3 +90,46 @@ def test_capture_checkin_new_id(sentry_init):
90
90
)
91
91
92
92
assert check_in_id == "a8098c1af86e11dabd1a00112444be1e"
93
+
94
+
95
+ def test_end_to_end (sentry_init , capture_envelopes ):
96
+ sentry_init ()
97
+ envelopes = capture_envelopes ()
98
+
99
+ capture_checkin (
100
+ monitor_slug = "abc123" ,
101
+ check_in_id = "112233" ,
102
+ duration = 123 ,
103
+ status = "ok" ,
104
+ )
105
+
106
+ check_in = envelopes [0 ].items [0 ].payload .json
107
+
108
+ # Check for final checkin
109
+ assert check_in ["check_in_id" ] == "112233"
110
+ assert check_in ["monitor_slug" ] == "abc123"
111
+ assert check_in ["status" ] == "ok"
112
+ assert check_in ["duration" ] == 123
113
+
114
+
115
+ def test_monitor_config (sentry_init , capture_envelopes ):
116
+ sentry_init ()
117
+ envelopes = capture_envelopes ()
118
+
119
+ monitor_config = {
120
+ "schedule" : {"type" : "crontab" , "value" : "0 0 * * *" },
121
+ }
122
+
123
+ capture_checkin (monitor_slug = "abc123" , monitor_config = monitor_config )
124
+ check_in = envelopes [0 ].items [0 ].payload .json
125
+
126
+ # Check for final checkin
127
+ assert check_in ["monitor_slug" ] == "abc123"
128
+ assert check_in ["monitor_config" ] == monitor_config
129
+
130
+ # Without passing a monitor_config the field is not in the checkin
131
+ capture_checkin (monitor_slug = "abc123" )
132
+ check_in = envelopes [1 ].items [0 ].payload .json
133
+
134
+ assert check_in ["monitor_slug" ] == "abc123"
135
+ assert "monitor_config" not in check_in
0 commit comments