55from swo_aws_extension .flows .order import PurchaseContext
66from swo_aws_extension .flows .order_utils import (
77 set_order_template ,
8- switch_order_status_to_complete_and_notify ,
9- switch_order_status_to_failed_and_notify ,
10- switch_order_status_to_process_and_notify ,
11- switch_order_status_to_query_and_notify ,
8+ switch_order_status_to_complete ,
9+ switch_order_status_to_failed ,
10+ switch_order_status_to_process ,
11+ switch_order_status_to_query ,
1212 update_processing_template_and_notify ,
1313)
1414
@@ -50,19 +50,15 @@ def test_switch_order_to_query_and_notify(
5050 "swo_aws_extension.flows.order_utils.query_order" ,
5151 return_value = order ,
5252 )
53- notification_mock = mocker .patch (
54- "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
55- )
5653
57- switch_order_status_to_query_and_notify (client , context , "TemplateName" ) # act
54+ switch_order_status_to_query (client , context , "TemplateName" ) # act
5855
5956 query_order_mock .assert_called_with (
6057 client ,
6158 context .order_id ,
6259 parameters = context .order ["parameters" ],
6360 template = new_template ,
6461 )
65- notification_mock .assert_called_once ()
6662
6763
6864def test_switch_order_to_query_and_notify_error (
@@ -86,11 +82,8 @@ def test_switch_order_to_query_and_notify_error(
8682 "swo_aws_extension.flows.order_utils.query_order" ,
8783 return_value = context .order ,
8884 )
89- notification_mock = mocker .patch (
90- "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
91- )
9285
93- switch_order_status_to_query_and_notify (client , context , "TemplateName" ) # act
86+ switch_order_status_to_query (client , context , "TemplateName" ) # act
9487
9588 query_order_mock .assert_called_with (
9689 client ,
@@ -99,30 +92,25 @@ def test_switch_order_to_query_and_notify_error(
9992 template = new_template ,
10093 error = context .order ["error" ],
10194 )
102- notification_mock .assert_called_once ()
10395
10496
105- def test_switch_order_to_failed_and_notify (mocker , order_factory , fulfillment_parameters_factory ):
97+ def test_switch_order_to_failed (mocker , order_factory , fulfillment_parameters_factory ):
10698 client = mocker .MagicMock (spec = MPTClient )
10799 order = order_factory (fulfillment_parameters = fulfillment_parameters_factory ())
108100 context = PurchaseContext .from_order_data (order )
109101 fail_order_mock = mocker .patch (
110102 "swo_aws_extension.flows.order_utils.fail_order" ,
111103 return_value = order ,
112104 )
113- notification_mock = mocker .patch (
114- "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
115- )
116105
117- switch_order_status_to_failed_and_notify (client , context , "Failure reason" ) # act
106+ switch_order_status_to_failed (client , context , "Failure reason" ) # act
118107
119108 fail_order_mock .assert_called_with (
120109 client ,
121110 context .order_id ,
122111 "Failure reason" ,
123112 parameters = context .order ["parameters" ],
124113 )
125- notification_mock .assert_called_once ()
126114
127115
128116def test_switch_order_to_process_and_notify (
@@ -142,19 +130,15 @@ def test_switch_order_to_process_and_notify(
142130 "swo_aws_extension.flows.order_utils.process_order" ,
143131 return_value = order ,
144132 )
145- notification_mock = mocker .patch (
146- "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
147- )
148133
149- switch_order_status_to_process_and_notify (mpt_client , context , "TemplateName" ) # act
134+ switch_order_status_to_process (mpt_client , context , "TemplateName" ) # act
150135
151136 process_order_mock .assert_called_once_with (
152137 mpt_client ,
153138 context .order_id ,
154139 parameters = context .order ["parameters" ],
155140 template = new_template ,
156141 )
157- notification_mock .assert_called_once ()
158142
159143
160144def test_switch_order_to_process_and_notify_error (
@@ -178,7 +162,7 @@ def test_switch_order_to_process_and_notify_error(
178162 "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
179163 )
180164
181- switch_order_status_to_process_and_notify (mpt_client , context , "TemplateName" ) # act
165+ switch_order_status_to_process (mpt_client , context , "TemplateName" ) # act
182166
183167 notification_mock .assert_not_called ()
184168
@@ -194,24 +178,20 @@ def test_switch_order_status_to_complete(
194178 return_value = new_template ,
195179 )
196180 order = order_factory (template = default_template )
197- notification_mock = mocker .patch (
198- "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
199- )
200181 context = PurchaseContext .from_order_data (order )
201182 complete_order_mock = mocker .patch (
202183 "swo_aws_extension.flows.order_utils.complete_order" ,
203184 return_value = order ,
204185 )
205186
206- switch_order_status_to_complete_and_notify (client , context , "TemplateName" ) # act
187+ switch_order_status_to_complete (client , context , "TemplateName" ) # act
207188
208189 complete_order_mock .assert_called_with (
209190 client ,
210191 context .order_id ,
211192 parameters = context .order ["parameters" ],
212193 template = new_template ,
213194 )
214- notification_mock .assert_called_once ()
215195
216196
217197def test_update_processing_template_and_notify (
0 commit comments