From 73d4c8fa74a7370cc578e25bf10f3d651b01fe9a Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Fri, 23 Nov 2018 19:08:49 +0100 Subject: [PATCH] TT#47906 Fix soundsets POST without contract or customer Change-Id: I148e475ed1766c0fa7e4cad981402c36ea24818d --- lib/NGCP/Panel/Role/API/SoundSets.pm | 1 + t/api-rest/api-soundsets.t | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/NGCP/Panel/Role/API/SoundSets.pm b/lib/NGCP/Panel/Role/API/SoundSets.pm index 615f4b1d01..42ce3eff02 100644 --- a/lib/NGCP/Panel/Role/API/SoundSets.pm +++ b/lib/NGCP/Panel/Role/API/SoundSets.pm @@ -69,6 +69,7 @@ sub pre_process_form_resource{ #So now we allow both, and one documented (contract_id) has higher priority my $customer_id = delete $resource->{customer_id}; $resource->{contract_id} //= $customer_id; + return $resource; } sub process_form_resource{ diff --git a/t/api-rest/api-soundsets.t b/t/api-rest/api-soundsets.t index 1ef2107bd6..81ff16d941 100644 --- a/t/api-rest/api-soundsets.t +++ b/t/api-rest/api-soundsets.t @@ -36,6 +36,7 @@ $test_machine->DATA_ITEM_STORE($fake_data->process('soundsets')); $test_machine->form_data_item( ); # create 3 new sound sets from DATA_ITEM my $soundsets_with_files = $test_machine->check_create_correct( 1, sub{ $_[0]->{name} .= $_[1]->{i}; } ); +my $soundsets_without_contract = $test_machine->check_create_correct( 1, sub{ delete $_[0]->{contract_id}; } ); my $soundsets_without_files = $test_machine->check_create_correct( 1, sub{ $_[0]->{name} .= $_[1]->{i}; $_[0]->{copy_from_default} = 0;