@@ -540,8 +540,21 @@ def test_handle_status_update(self, mock_send: Mock, mock_feed_hook: Mock):
540
540
status = factory (Status , data .status_final )
541
541
status .statustype = factory (StatusType , data .status_type_final )
542
542
543
+ ztc = ZaakTypeConfigFactory .create (
544
+ catalogus = None ,
545
+ identificatie = data .zaak_type ["identificatie" ],
546
+ # set this to notify
547
+ notify_status_changes = True ,
548
+ )
549
+ status_type_config = ZaakTypeStatusTypeConfigFactory .create (
550
+ zaaktype_config = ztc ,
551
+ omschrijving = data .status_type_final ["omschrijving" ],
552
+ statustype_url = data .status_type_final ["url" ],
553
+ notify_status_change = True ,
554
+ )
555
+
543
556
# first call
544
- handle_status_update (user , case , status )
557
+ handle_status_update (user , case , status , status_type_config )
545
558
546
559
mock_send .assert_called_once ()
547
560
@@ -566,7 +579,7 @@ def test_handle_status_update(self, mock_send: Mock, mock_feed_hook: Mock):
566
579
)
567
580
568
581
# second call with same case/status
569
- handle_status_update (user , case , status )
582
+ handle_status_update (user , case , status , status_type_config )
570
583
571
584
# no duplicate mail for this user/case/status
572
585
mock_send .assert_not_called ()
@@ -578,7 +591,7 @@ def test_handle_status_update(self, mock_send: Mock, mock_feed_hook: Mock):
578
591
)
579
592
# other user is fine
580
593
other_user = UserFactory .create ()
581
- handle_status_update (other_user , case , status )
594
+ handle_status_update (other_user , case , status , status_type_config )
582
595
583
596
mock_send .assert_called_once ()
584
597
@@ -594,7 +607,7 @@ def test_handle_status_update(self, mock_send: Mock, mock_feed_hook: Mock):
594
607
status .statustype = factory (
595
608
StatusType , copy_with_new_uuid (data .status_type_final )
596
609
)
597
- handle_status_update (user , case , status )
610
+ handle_status_update (user , case , status , status_type_config )
598
611
599
612
# not sent because we already send to this user within the frequency
600
613
mock_send .assert_not_called ()
@@ -611,7 +624,42 @@ def test_handle_status_update(self, mock_send: Mock, mock_feed_hook: Mock):
611
624
status .statustype = factory (
612
625
StatusType , copy_with_new_uuid (data .status_type_final )
613
626
)
614
- handle_status_update (user , case , status )
627
+ handle_status_update (user , case , status , status_type_config )
615
628
616
629
# this one succeeds
617
630
mock_send .assert_called_once ()
631
+
632
+ @patch ("open_inwoner.userfeed.hooks.case_status_notification_received" )
633
+ @patch ("open_inwoner.openzaak.notifications.send_case_update_email" )
634
+ def test_action_required_template (self , mock_send : Mock , mock_feed_hook : Mock ):
635
+ data = MockAPIData ()
636
+ user = data .user_initiator
637
+
638
+ case = factory (Zaak , data .zaak )
639
+ case .zaaktype = factory (ZaakType , data .zaak_type )
640
+
641
+ status = factory (Status , data .status_final )
642
+ status .statustype = factory (StatusType , data .status_type_final )
643
+
644
+ ztc = ZaakTypeConfigFactory .create (
645
+ catalogus = None ,
646
+ identificatie = data .zaak_type ["identificatie" ],
647
+ # set this to notify
648
+ notify_status_changes = True ,
649
+ )
650
+ status_type_config = ZaakTypeStatusTypeConfigFactory .create (
651
+ zaaktype_config = ztc ,
652
+ omschrijving = data .status_type_final ["omschrijving" ],
653
+ statustype_url = data .status_type_final ["url" ],
654
+ notify_status_change = True ,
655
+ action_required = True ,
656
+ )
657
+
658
+ handle_status_update (user , case , status , status_type_config )
659
+
660
+ mock_send .assert_called_once ()
661
+ # check call arguments
662
+ args = mock_send .call_args .args
663
+ self .assertEqual (args [0 ], user )
664
+ self .assertEqual (args [1 ].url , case .url )
665
+ self .assertEqual (args [2 ], "case_status_notification_action_required" )
0 commit comments