@@ -440,3 +440,63 @@ def test_counter_is_incremented_when_workflows_was_incomplete(
440
440
callable_object (context = context_create_example )
441
441
442
442
mocked .incr .assert_called_with ("jbi.action.fnx.incomplete.count" )
443
+
444
+
445
+ def test_step_function_counter_incremented (
446
+ action_params_factory , action_context_factory
447
+ ):
448
+ context = action_context_factory (operation = Operation .CREATE )
449
+ executor = Executor (action_params_factory (steps = {"new" : ["create_issue" ]}))
450
+ with mock .patch ("jbi.runner.statsd" ) as mocked :
451
+ executor (context = context )
452
+ mocked .incr .assert_called_with ("jbi.steps.create_issue.count" )
453
+
454
+
455
+ def test_counter_is_incremented_for_create (
456
+ webhook_factory , actions_factory , mocked_bugzilla , bug_factory
457
+ ):
458
+ webhook_payload = webhook_factory (
459
+ event__target = "bug" ,
460
+ bug__see_also = [],
461
+ )
462
+ mocked_bugzilla .get_bug .return_value = webhook_payload .bug
463
+ with mock .patch ("jbi.runner.statsd" ) as mocked :
464
+ result = execute_action (
465
+ request = webhook_factory (),
466
+ actions = actions_factory (),
467
+ )
468
+ mocked .incr .assert_any_call ("jbi.operation.create.count" )
469
+
470
+
471
+ def test_counter_is_incremented_for_update (
472
+ actions_factory , webhook_factory , mocked_bugzilla , mocked_jira
473
+ ):
474
+ webhook_payload = webhook_factory (
475
+ event__target = "bug" ,
476
+ bug__see_also = ["https://mozilla.atlassian.net/browse/JBI-234" ],
477
+ )
478
+ mocked_bugzilla .get_bug .return_value = webhook_payload .bug
479
+ mocked_jira .get_issue .return_value = {"fields" : {"project" : {"key" : "JBI" }}}
480
+ with mock .patch ("jbi.runner.statsd" ) as mocked :
481
+ result = execute_action (
482
+ request = webhook_payload ,
483
+ actions = actions_factory (),
484
+ )
485
+ mocked .incr .assert_any_call ("jbi.operation.update.count" )
486
+
487
+
488
+ def test_counter_is_incremented_for_comment (
489
+ actions_factory , webhook_factory , mocked_bugzilla , mocked_jira
490
+ ):
491
+ webhook_payload = webhook_factory (
492
+ event__target = "comment" ,
493
+ bug__see_also = ["https://mozilla.atlassian.net/browse/JBI-234" ],
494
+ )
495
+ mocked_bugzilla .get_bug .return_value = webhook_payload .bug
496
+ mocked_jira .get_issue .return_value = {"fields" : {"project" : {"key" : "JBI" }}}
497
+ with mock .patch ("jbi.runner.statsd" ) as mocked :
498
+ result = execute_action (
499
+ request = webhook_payload ,
500
+ actions = actions_factory (),
501
+ )
502
+ mocked .incr .assert_any_call ("jbi.operation.comment.count" )
0 commit comments