Skip to content

Commit

Permalink
circulation: fix change pickup location on loans
Browse files Browse the repository at this point in the history
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 <aly.badr@rero.ch>
  • Loading branch information
Aly Badr committed Aug 21, 2020
1 parent 6d20991 commit e51848b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rero_ils/modules/loans/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
8 changes: 4 additions & 4 deletions tests/api/circulation/test_actions_views_change_pickup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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

0 comments on commit e51848b

Please sign in to comment.