From e51848b720cc60cb18c6ae47459ee302294a6ccc Mon Sep 17 00:00:00 2001 From: Aly Badr Date: Fri, 21 Aug 2020 10:28:57 +0200 Subject: [PATCH] circulation: fix change pickup location on loans Fixes a bug where change pickup location was allowed for in_transit_to_house loans and not allowed for in_transit_for_pickup loans. Co-Authored-by: Aly Badr --- rero_ils/modules/loans/api.py | 2 +- tests/api/circulation/test_actions_views_change_pickup.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rero_ils/modules/loans/api.py b/rero_ils/modules/loans/api.py index 402ffc2f1e..df7386ceeb 100644 --- a/rero_ils/modules/loans/api.py +++ b/rero_ils/modules/loans/api.py @@ -170,7 +170,7 @@ def update_pickup_location(self, pickup_location_pid): :return: the new updated loan. """ if self['state'] not in [ - LoanState.PENDING, LoanState.ITEM_IN_TRANSIT_TO_HOUSE]: + LoanState.PENDING, LoanState.ITEM_IN_TRANSIT_FOR_PICKUP]: raise NoCirculationActionIsPermitted( 'No circulation action is permitted') diff --git a/tests/api/circulation/test_actions_views_change_pickup.py b/tests/api/circulation/test_actions_views_change_pickup.py index 18329d1f72..a99aeeef60 100644 --- a/tests/api/circulation/test_actions_views_change_pickup.py +++ b/tests/api/circulation/test_actions_views_change_pickup.py @@ -98,7 +98,7 @@ def test_change_pickup_location_request_for_other_loans( ) ) assert res.status_code == 403 - # CHANGE_PICKUP_LOCATION_4: update denied on IN_TRANSIT_FOR_PICKUP loans. + # CHANGE_PICKUP_LOCATION_4: update allowed on IN_TRANSIT_FOR_PICKUP loans. item, patron, loan = item_in_transit_martigny_patron_and_loan_for_pickup res, data = postdata( client, @@ -108,8 +108,8 @@ def test_change_pickup_location_request_for_other_loans( pickup_location_pid=loc_public_fully.pid ) ) - assert res.status_code == 403 - # CHANGE_PICKUP_LOCATION_5: update is allowed on IN_TRANSIT_TO_HOUSE loans. + assert res.status_code == 200 + # CHANGE_PICKUP_LOCATION_5: update denied on IN_TRANSIT_TO_HOUSE loans. item, patron, loan = item_in_transit_martigny_patron_and_loan_to_house res, data = postdata( client, @@ -119,4 +119,4 @@ def test_change_pickup_location_request_for_other_loans( pickup_location_pid=loc_public_fully.pid ) ) - assert res.status_code == 200 + assert res.status_code == 403