@@ -861,7 +861,7 @@ def test_sync_agreements_by_3yc_enroll_status_no_cust(
861861 mock_mpt_client , THREE_YC_TEMP_3YC_STATUSES
862862 )
863863 mock_get_customer_or_process_lost_customer .assert_called_once_with (
864- mock_mpt_client , mock_adobe_client , agreement , customer_id = ""
864+ mock_mpt_client , mock_adobe_client , agreement , customer_id = "a-client-id "
865865 )
866866 mock_update_agreement .assert_not_called ()
867867 mock_sync_agreement .assert_not_called ()
@@ -1476,6 +1476,7 @@ def test_sync_global_customer_update_not_required(
14761476 agreement = agreement_factory (
14771477 lines = lines_factory (external_vendor_id = "77777777CA" , unit_purchase_price = 10.11 ),
14781478 fulfillment_parameters = [
1479+ {"externalId" : "customerId" , "value" : "a-client-id" },
14791480 {"externalId" : "globalCustomer" , "value" : ["Yes" ]},
14801481 {"externalId" : "deployments" , "value" : "deployment-id - DE" },
14811482 ],
@@ -1609,8 +1610,10 @@ def test_sync_global_customer_update_adobe_error(
16091610 agreement = agreement_factory (
16101611 lines = lines_factory (external_vendor_id = "77777777CA" , unit_purchase_price = 10.11 ),
16111612 fulfillment_parameters = [
1613+ {"externalId" : "customerId" , "value" : "a-client-id" },
16121614 {"externalId" : "globalCustomer" , "value" : ["Yes" ]},
16131615 {"externalId" : "deployments" , "value" : "deployment-id - DE" },
1616+ {"externalId" : "deploymentId" , "value" : "deployment-id" },
16141617 ],
16151618 subscriptions = [
16161619 {"id" : "SUB-1000-2000-3000" , "status" : "Active" , "item" : {"id" : "ITM-0000-0001-0001" }},
@@ -1774,6 +1777,7 @@ def test_sync_global_customer_parameters_error(
17741777 agreement = agreement_factory (
17751778 lines = lines_factory (external_vendor_id = "77777777CA" , unit_purchase_price = 10.11 ),
17761779 fulfillment_parameters = [
1780+ {"externalId" : "customerId" , "value" : "a-client-id" },
17771781 {"externalId" : "globalCustomer" , "value" : ["Yes" ]},
17781782 {"externalId" : "deployments" , "value" : "deployment-id - DE" },
17791783 ],
@@ -2103,8 +2107,10 @@ def test_sync_agreement_error_getting_adobe_customer(
21032107 agreement = agreement_factory (
21042108 lines = lines_factory (external_vendor_id = "77777777CA" , unit_purchase_price = 10.11 ),
21052109 fulfillment_parameters = [
2110+ {"externalId" : "customerId" , "value" : "a-client-id" },
21062111 {"externalId" : "globalCustomer" , "value" : ["Yes" ]},
21072112 {"externalId" : "deployments" , "value" : "deployment-id - DE" },
2113+ {"externalId" : "deploymentId" , "value" : "deployment-id" },
21082114 ],
21092115 subscriptions = [
21102116 {
@@ -2388,6 +2394,39 @@ def test_sync_agreement_prices_with_missing_prices(
23882394 )
23892395
23902396
2397+ def test_sync_agreement_empty_customer_id (
2398+ mocker ,
2399+ mock_mpt_client ,
2400+ agreement_factory ,
2401+ mock_notify_agreement_unhandled_exception_in_teams ,
2402+ caplog ,
2403+ ):
2404+ agreement = agreement_factory (
2405+ fulfillment_parameters = [{"externalId" : "FakeFulfillmentParam" }],
2406+ ordering_parameters = [{"externalId" : "FakeOrderingParam" }],
2407+ )
2408+ mock_notify_agreement_unhandled_exception_in_teams = mocker .patch (
2409+ "adobe_vipm.flows.sync.notify_agreement_unhandled_exception_in_teams"
2410+ )
2411+
2412+ sync_agreement (
2413+ mock_mpt_client , agreement , dry_run = False , sync_prices = False
2414+ ) # act
2415+
2416+ expected_params = {
2417+ "ordering" : [{"externalId" : "FakeOrderingParam" }],
2418+ "fulfillment" : [{"externalId" : "FakeFulfillmentParam" }],
2419+ }
2420+ expected_message = (
2421+ f"CustomerId not found in Agreement AGR-2119-4550-8674-5962 with params "
2422+ f"{ expected_params } . Skipping."
2423+ )
2424+ mock_notify_agreement_unhandled_exception_in_teams .assert_called_once_with (
2425+ "AGR-2119-4550-8674-5962" , expected_message
2426+ )
2427+ assert expected_message in caplog .messages
2428+
2429+
23912430@pytest .mark .usefixtures ("mock_get_agreements_by_customer_deployments" )
23922431def test_sync_agreement_lost_customer (
23932432 mocker ,
0 commit comments