@@ -173,6 +173,7 @@ def test_read_heartbeat_all_services_fail(anon_client, mocked_jira, mocked_bugzi
173
173
"all_projects_are_visible" : False ,
174
174
"all_projects_have_permissions" : False ,
175
175
"all_projects_components_exist" : False ,
176
+ "all_projects_issue_types_exist" : False ,
176
177
},
177
178
"bugzilla" : {
178
179
"up" : False ,
@@ -181,7 +182,7 @@ def test_read_heartbeat_all_services_fail(anon_client, mocked_jira, mocked_bugzi
181
182
}
182
183
183
184
184
- def test_read_heartbeat_jira_services_fails (anon_client , mocked_jira , mocked_bugzilla ):
185
+ def test_read_heartbeat_jira_services_fails (anon_client , mocked_jira ):
185
186
"""/__heartbeat__ returns 503 when one service is unavailable."""
186
187
mocked_jira .get_server_info .return_value = None
187
188
@@ -193,12 +194,11 @@ def test_read_heartbeat_jira_services_fails(anon_client, mocked_jira, mocked_bug
193
194
"all_projects_are_visible" : False ,
194
195
"all_projects_have_permissions" : False ,
195
196
"all_projects_components_exist" : False ,
197
+ "all_projects_issue_types_exist" : False ,
196
198
}
197
199
198
200
199
- def test_read_heartbeat_bugzilla_webhooks_fails (
200
- anon_client , mocked_jira , mocked_bugzilla
201
- ):
201
+ def test_read_heartbeat_bugzilla_webhooks_fails (anon_client , mocked_bugzilla ):
202
202
mocked_bugzilla .logged_in .return_value = True
203
203
mocked_bugzilla .list_webhooks .return_value = [
204
204
bugzilla_webhook_factory (enabled = False )
@@ -213,9 +213,7 @@ def test_read_heartbeat_bugzilla_webhooks_fails(
213
213
}
214
214
215
215
216
- def test_heartbeat_bugzilla_reports_webhooks_errors (
217
- anon_client , mocked_jira , mocked_bugzilla
218
- ):
216
+ def test_heartbeat_bugzilla_reports_webhooks_errors (anon_client , mocked_bugzilla ):
219
217
mocked_bugzilla .logged_in .return_value = True
220
218
mocked_bugzilla .list_webhooks .return_value = [
221
219
bugzilla_webhook_factory (id = 1 , errors = 0 , product = "Remote Settings" ),
@@ -233,13 +231,9 @@ def test_heartbeat_bugzilla_reports_webhooks_errors(
233
231
)
234
232
235
233
236
- def test_read_heartbeat_bugzilla_services_fails (
237
- anon_client , mocked_jira , mocked_bugzilla
238
- ):
234
+ def test_read_heartbeat_bugzilla_services_fails (anon_client , mocked_bugzilla ):
239
235
"""/__heartbeat__ returns 503 when one service is unavailable."""
240
236
mocked_bugzilla .logged_in .return_value = False
241
- mocked_jira .get_server_info .return_value = {}
242
- mocked_jira .projects .return_value = [{"key" : "DevTest" }]
243
237
244
238
resp = anon_client .get ("/__heartbeat__" )
245
239
@@ -265,6 +259,10 @@ def test_read_heartbeat_success(anon_client, mocked_jira, mocked_bugzilla):
265
259
"DELETE_ISSUES" : {"havePermission" : True },
266
260
},
267
261
}
262
+ mocked_jira .issue_createmeta_issuetypes .return_value = [
263
+ {"name" : "Task" },
264
+ {"name" : "Bug" },
265
+ ]
268
266
269
267
resp = anon_client .get ("/__heartbeat__" )
270
268
@@ -275,6 +273,7 @@ def test_read_heartbeat_success(anon_client, mocked_jira, mocked_bugzilla):
275
273
"all_projects_are_visible" : True ,
276
274
"all_projects_have_permissions" : True ,
277
275
"all_projects_components_exist" : True ,
276
+ "all_projects_issue_types_exist" : True ,
278
277
},
279
278
"bugzilla" : {
280
279
"up" : True ,
@@ -283,25 +282,20 @@ def test_read_heartbeat_success(anon_client, mocked_jira, mocked_bugzilla):
283
282
}
284
283
285
284
286
- def test_jira_heartbeat_visible_projects (anon_client , mocked_jira , mocked_bugzilla ):
285
+ def test_jira_heartbeat_visible_projects (anon_client , mocked_jira ):
287
286
"""/__heartbeat__ fails if configured projects don't match."""
288
287
mocked_jira .get_server_info .return_value = {}
289
288
290
289
resp = anon_client .get ("/__heartbeat__" )
291
290
292
291
assert resp .status_code == 503
293
- assert resp .json ()["jira" ] == {
294
- "up" : True ,
295
- "all_projects_are_visible" : False ,
296
- "all_projects_have_permissions" : False ,
297
- "all_projects_components_exist" : False ,
298
- }
292
+ assert resp .json ()["jira" ]["up" ]
293
+ assert not resp .json ()["jira" ]["all_projects_are_visible" ]
299
294
300
295
301
- def test_jira_heartbeat_missing_permissions (anon_client , mocked_jira , mocked_bugzilla ):
296
+ def test_jira_heartbeat_missing_permissions (anon_client , mocked_jira ):
302
297
"""/__heartbeat__ fails if configured projects don't match."""
303
298
mocked_jira .get_server_info .return_value = {}
304
- mocked_jira .get_project_components .return_value = [{"name" : "Main" }]
305
299
mocked_jira .get_project_permission_scheme .return_value = {
306
300
"permissions" : {
307
301
"ADD_COMMENTS" : {"havePermission" : True },
@@ -314,25 +308,34 @@ def test_jira_heartbeat_missing_permissions(anon_client, mocked_jira, mocked_bug
314
308
resp = anon_client .get ("/__heartbeat__" )
315
309
316
310
assert resp .status_code == 503
317
- assert resp .json ()["jira" ] == {
318
- "up" : True ,
319
- "all_projects_are_visible" : False ,
320
- "all_projects_have_permissions" : False ,
321
- "all_projects_components_exist" : True ,
322
- }
311
+ assert resp .json ()["jira" ]["up" ]
312
+ assert not resp .json ()["jira" ]["all_projects_have_permissions" ]
323
313
324
314
325
- def test_jira_heartbeat_unknown_components (anon_client , mocked_jira , mocked_bugzilla ):
326
- mocked_bugzilla .logged_in .return_value = True
327
- mocked_bugzilla .list_webhooks .return_value = [bugzilla_webhook_factory ()]
315
+ def test_jira_heartbeat_unknown_components (anon_client , mocked_jira ):
328
316
mocked_jira .get_server_info .return_value = {}
329
317
330
318
resp = anon_client .get ("/__heartbeat__" )
331
319
332
320
assert resp .status_code == 503
321
+ assert resp .json ()["jira" ]["up" ]
333
322
assert not resp .json ()["jira" ]["all_projects_components_exist" ]
334
323
335
324
325
+ def test_jira_heartbeat_unknown_issue_types (anon_client , mocked_jira ):
326
+ mocked_jira .get_server_info .return_value = {}
327
+ mocked_jira .issue_createmeta_issuetypes .return_value = [
328
+ {"name" : "Task" },
329
+ # missing Bug
330
+ ]
331
+
332
+ resp = anon_client .get ("/__heartbeat__" )
333
+
334
+ assert resp .status_code == 503
335
+ assert resp .json ()["jira" ]["up" ]
336
+ assert not resp .json ()["jira" ]["all_projects_issue_types_exist" ]
337
+
338
+
336
339
def test_head_heartbeat_success (anon_client , mocked_jira , mocked_bugzilla ):
337
340
"""/__heartbeat__ support head requests"""
338
341
mocked_bugzilla .logged_in .return_value = True
@@ -348,6 +351,10 @@ def test_head_heartbeat_success(anon_client, mocked_jira, mocked_bugzilla):
348
351
"DELETE_ISSUES" : {"havePermission" : True },
349
352
},
350
353
}
354
+ mocked_jira .issue_createmeta_issuetypes .return_value = [
355
+ {"name" : "Task" },
356
+ {"name" : "Bug" },
357
+ ]
351
358
352
359
resp = anon_client .head ("/__heartbeat__" )
353
360
0 commit comments