Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circulation policy: ignore settings when deleting a policy #672

Merged
merged 1 commit into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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