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 (
@@ -146,15 +134,14 @@ def test_switch_order_to_process_and_notify(
146134 "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
147135 )
148136
149- switch_order_status_to_process_and_notify (mpt_client , context , "TemplateName" ) # act
137+ switch_order_status_to_process (mpt_client , context , "TemplateName" ) # act
150138
151139 process_order_mock .assert_called_once_with (
152140 mpt_client ,
153141 context .order_id ,
154142 parameters = context .order ["parameters" ],
155143 template = new_template ,
156144 )
157- notification_mock .assert_called_once ()
158145
159146
160147def test_switch_order_to_process_and_notify_error (
@@ -178,7 +165,7 @@ def test_switch_order_to_process_and_notify_error(
178165 "swo_aws_extension.flows.order_utils.MPTNotificationManager" ,
179166 )
180167
181- switch_order_status_to_process_and_notify (mpt_client , context , "TemplateName" ) # act
168+ switch_order_status_to_process (mpt_client , context , "TemplateName" ) # act
182169
183170 notification_mock .assert_not_called ()
184171
@@ -203,15 +190,14 @@ def test_switch_order_status_to_complete(
203190 return_value = order ,
204191 )
205192
206- switch_order_status_to_complete_and_notify (client , context , "TemplateName" ) # act
193+ switch_order_status_to_complete (client , context , "TemplateName" ) # act
207194
208195 complete_order_mock .assert_called_with (
209196 client ,
210197 context .order_id ,
211198 parameters = context .order ["parameters" ],
212199 template = new_template ,
213200 )
214- notification_mock .assert_called_once ()
215201
216202
217203def test_update_processing_template_and_notify (
0 commit comments