Skip to content

Commit

Permalink
circulation policy: ignore settings when deleting a policy
Browse files Browse the repository at this point in the history
* Fixes an issue when cipo settings blocked its deletion.
* Closes rero/rero-ils-ui#76

Co-Authored-by: Aly Badr <aly.badr@rero.ch>
  • Loading branch information
Aly Badr committed Dec 13, 2019
1 parent 3781ff7 commit e2f8963
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 0 additions & 3 deletions rero_ils/modules/circ_policies/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ def reasons_to_keep(self):
is_default = self.get('is_default')
if is_default:
others['is_default'] = is_default
has_settings = self.get('settings')
if has_settings:
others['has_settings'] = has_settings
return others

def get_links_to_me(self):
Expand Down
7 changes: 3 additions & 4 deletions tests/api/test_circ_policies_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,11 @@ def test_circ_policy_secure_api_delete(client,
record_url = url_for('invenio_records_rest.cipo_item',
pid_value=circ_policy_short_martigny.pid)

with pytest.raises(IlsRecordError.NotDeleted):
res = client.delete(record_url)
assert res.status_code == 200
res = client.delete(record_url)
assert res.status_code == 204

# Sion
login_user_via_session(client, librarian_sion_no_email.user)

res = client.delete(record_url)
assert res.status_code == 403
assert res.status_code == 410
3 changes: 1 addition & 2 deletions tests/ui/circ_policies/test_circ_policies_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ def test_circ_policy_can_not_delete(circ_policy_default_martigny,

others = circ_policy_short_martigny.reasons_to_keep()
assert 'is_default' not in others
assert not circ_policy_short_martigny.can_delete
assert others['has_settings']
assert circ_policy_short_martigny.can_delete


def test_circ_policy_can_delete(app, circ_policy_martigny_data_tmp):
Expand Down

0 comments on commit e2f8963

Please sign in to comment.