Skip to content

Commit 9579333

Browse files
bdjilkad3rky
authored andcommitted
MPT-9677 Add terminate to order validation
1 parent ac17926 commit 9579333

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

ffc/flows/validation.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from mpt_extension_sdk.flows.pipeline import Pipeline
55

66
from ffc.flows.error import strip_trace_id
7-
from ffc.flows.order import OrderContext, is_purchase_order
7+
from ffc.flows.order import OrderContext, is_purchase_order, is_terminate_order
88
from ffc.flows.steps import OrderTypeIsNotSupported
99
from ffc.notifications import notify_unhandled_exception_in_teams
1010

@@ -25,6 +25,8 @@ def validate_order(client, order):
2525
try:
2626
if is_purchase_order(order):
2727
has_errors, order = validate_purchase_order(client, order)
28+
elif is_terminate_order(order):
29+
has_errors, order = validate_terminate_order(client, order)
2830
else:
2931
has_errors, order = validate_other_orders(client, order)
3032

@@ -46,6 +48,10 @@ def validate_purchase_order(client, order):
4648
return False, order
4749

4850

51+
def validate_terminate_order(client, order):
52+
return False, order
53+
54+
4955
def validate_other_orders(client, order):
5056
pipeline = Pipeline(
5157
OrderTypeIsNotSupported(),

tests/ffc/flows/test_validation.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
validate_order,
66
validate_other_orders,
77
validate_purchase_order,
8+
validate_terminate_order,
89
)
910

1011

11-
def test_validate_purchase(
12+
def test_validate_supported_order(
1213
mpt_client,
1314
processing_purchase_order,
15+
processing_termination_order,
1416
):
1517
has_errors, order = validate_purchase_order(
1618
mpt_client,
@@ -20,12 +22,19 @@ def test_validate_purchase(
2022
assert has_errors is False
2123
assert order["error"] is None
2224

25+
has_errors, order = validate_terminate_order(
26+
mpt_client,
27+
processing_termination_order,
28+
)
29+
30+
assert has_errors is False
31+
assert order["error"] is None
32+
2333

2434
@pytest.mark.parametrize(
2535
"order",
2636
[
2737
"processing_change_order",
28-
"processing_termination_order",
2938
"processing_configuration_order",
3039
],
3140
)
@@ -43,20 +52,24 @@ def test_validate_other_orders(
4352
assert order["error"] == err_msg
4453

4554

46-
def test_validate_order_purchase(
55+
def test_validate_order(
4756
mpt_client,
4857
processing_purchase_order,
58+
processing_termination_order,
4959
):
5060
order = validate_order(mpt_client, processing_purchase_order)
5161

5262
assert order["error"] is None
5363

64+
order = validate_order(mpt_client, processing_termination_order)
65+
66+
assert order["error"] is None
67+
5468

5569
@pytest.mark.parametrize(
5670
"order",
5771
[
5872
"processing_change_order",
59-
"processing_termination_order",
6073
"processing_configuration_order",
6174
],
6275
)

0 commit comments

Comments
 (0)