invenio-app-ils 4.5.0__py2.py3-none-any.whl → 5.0.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- invenio_app_ils/__init__.py +1 -1
- invenio_app_ils/assets/semantic-ui/less/theme.config +103 -0
- invenio_app_ils/circulation/api.py +9 -5
- invenio_app_ils/circulation/config.py +1 -0
- invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py +1 -1
- invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +2 -2
- invenio_app_ils/circulation/notifications/api.py +9 -1
- invenio_app_ils/circulation/notifications/messages.py +2 -1
- invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/update_dates.html +19 -0
- invenio_app_ils/cli.py +92 -64
- invenio_app_ils/config.py +10 -2
- invenio_app_ils/documents/loaders/jsonschemas/document.py +1 -1
- invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +2 -2
- invenio_app_ils/patrons/anonymization.py +0 -4
- invenio_app_ils/series/loaders/jsonschemas/series.py +1 -1
- invenio_app_ils/webpack.py +27 -0
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/METADATA +56 -43
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/RECORD +24 -112
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/entry_points.txt +3 -0
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/top_level.txt +0 -1
- invenio_app_ils/notifications/admin.py +0 -57
- tests/__init__.py +0 -8
- tests/api/__init__.py +0 -8
- tests/api/acquisition/__init__.py +0 -8
- tests/api/acquisition/test_acq_orders_crud.py +0 -99
- tests/api/acquisition/test_acq_orders_permissions.py +0 -104
- tests/api/acquisition/test_acq_providers_permissions.py +0 -83
- tests/api/circulation/__init__.py +0 -8
- tests/api/circulation/test_expired_loans.py +0 -88
- tests/api/circulation/test_loan_bulk_extend.py +0 -169
- tests/api/circulation/test_loan_checkout.py +0 -422
- tests/api/circulation/test_loan_default_durations.py +0 -43
- tests/api/circulation/test_loan_document_resolver.py +0 -18
- tests/api/circulation/test_loan_extend.py +0 -122
- tests/api/circulation/test_loan_item_permissions.py +0 -135
- tests/api/circulation/test_loan_item_resolver.py +0 -26
- tests/api/circulation/test_loan_list_permissions.py +0 -98
- tests/api/circulation/test_loan_patron_resolver.py +0 -38
- tests/api/circulation/test_loan_request.py +0 -338
- tests/api/circulation/test_loan_update.py +0 -150
- tests/api/circulation/test_notifications.py +0 -221
- tests/api/conftest.py +0 -227
- tests/api/document_requests/__init__.py +0 -8
- tests/api/document_requests/test_document_requests.py +0 -131
- tests/api/document_requests/test_document_requests_permissions.py +0 -159
- tests/api/document_requests/test_notifications_filter.py +0 -35
- tests/api/ill/__init__.py +0 -8
- tests/api/ill/test_ill_brw_crud.py +0 -74
- tests/api/ill/test_ill_brw_reqs_patron_loan_create_action.py +0 -198
- tests/api/ill/test_ill_brw_reqs_patron_loan_extension_actions.py +0 -280
- tests/api/ill/test_ill_brw_reqs_permissions.py +0 -163
- tests/api/ill/test_ill_providers_permissions.py +0 -82
- tests/api/ils/__init__.py +0 -8
- tests/api/ils/documents/__init__.py +0 -8
- tests/api/ils/documents/test_document_crud.py +0 -57
- tests/api/ils/documents/test_document_permissions.py +0 -100
- tests/api/ils/documents/test_document_resolvers.py +0 -35
- tests/api/ils/eitems/__init__.py +0 -8
- tests/api/ils/eitems/test_eitems_crud.py +0 -42
- tests/api/ils/eitems/test_eitems_permissions.py +0 -85
- tests/api/ils/eitems/test_files.py +0 -162
- tests/api/ils/items/__init__.py +0 -8
- tests/api/ils/items/test_apis.py +0 -43
- tests/api/ils/items/test_items_crud.py +0 -99
- tests/api/ils/items/test_items_permissions.py +0 -107
- tests/api/ils/records_relations/__init__.py +0 -8
- tests/api/ils/records_relations/helpers.py +0 -115
- tests/api/ils/records_relations/test_records_relations_parentchild.py +0 -560
- tests/api/ils/records_relations/test_records_relations_sequence.py +0 -294
- tests/api/ils/records_relations/test_records_relations_siblings.py +0 -751
- tests/api/ils/series/__init__.py +0 -8
- tests/api/ils/series/test_series_permissions.py +0 -95
- tests/api/ils/test_anonymization.py +0 -181
- tests/api/ils/test_apis.py +0 -76
- tests/api/ils/test_closures.py +0 -353
- tests/api/ils/test_errors.py +0 -125
- tests/api/ils/test_facets.py +0 -88
- tests/api/ils/test_internal_locations.py +0 -96
- tests/api/ils/test_loaders.py +0 -51
- tests/api/ils/test_metadata_extensions.py +0 -206
- tests/api/ils/test_notifications.py +0 -173
- tests/api/ils/test_notifications_mails.py +0 -37
- tests/api/ils/test_notifications_permissions.py +0 -55
- tests/api/ils/test_patrons.py +0 -102
- tests/api/ils/test_record_delete.py +0 -42
- tests/api/ils/test_record_permissions.py +0 -132
- tests/api/ils/test_resolvers.py +0 -205
- tests/api/ils/test_stats.py +0 -142
- tests/api/ils/test_tasks.py +0 -209
- tests/api/ils/test_vocabularies.py +0 -35
- tests/conftest.py +0 -221
- tests/data/acq_orders.json +0 -110
- tests/data/acq_providers.json +0 -12
- tests/data/document_requests.json +0 -77
- tests/data/documents.json +0 -238
- tests/data/eitems.json +0 -71
- tests/data/ill_borrowing_requests.json +0 -77
- tests/data/ill_providers.json +0 -12
- tests/data/internal_locations.json +0 -22
- tests/data/items.json +0 -304
- tests/data/loans.json +0 -133
- tests/data/loans_most_loaned.json +0 -128
- tests/data/locations.json +0 -26
- tests/data/series.json +0 -33
- tests/helpers.py +0 -107
- tests/templates/notifications/title_body.html +0 -8
- tests/templates/notifications/title_body_html.html +0 -13
- tests/templates/notifications/title_body_html_ctx.html +0 -13
- tests/templates/notifications/title_only.html +0 -3
- tests/test_post_logout_redirect.py +0 -23
- tests/test_version.py +0 -17
- /tests/templates/notifications/blank.html → /invenio_app_ils/assets/semantic-ui/templates/.gitkeep +0 -0
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/WHEEL +0 -0
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/AUTHORS.rst +0 -0
- {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2020 CERN.
|
|
4
|
-
#
|
|
5
|
-
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
-
|
|
8
|
-
"""Test records relations sequence."""
|
|
9
|
-
|
|
10
|
-
import json
|
|
11
|
-
|
|
12
|
-
from flask import url_for
|
|
13
|
-
|
|
14
|
-
from tests.helpers import get_test_record, user_login
|
|
15
|
-
|
|
16
|
-
from .helpers import (
|
|
17
|
-
recrel_assert_record_relations,
|
|
18
|
-
recrel_choose_endpoints_and_do_request,
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def _test_sequence_invalid_relations_should_fail(
|
|
23
|
-
client, json_headers, invalids, status_code=400
|
|
24
|
-
):
|
|
25
|
-
"""Test relation creation with invalid link relation should fail."""
|
|
26
|
-
api_endpoint_series = "invenio_app_ils_relations.serid_relations"
|
|
27
|
-
|
|
28
|
-
for invalid in invalids:
|
|
29
|
-
next_pid_value = invalid["next_pid_value"]
|
|
30
|
-
next_pid_type = invalid["next_pid_type"]
|
|
31
|
-
previous_pid_value = invalid["previous_pid_value"]
|
|
32
|
-
previous_pid_type = invalid["previous_pid_type"]
|
|
33
|
-
relation_type = invalid["relation_type"]
|
|
34
|
-
|
|
35
|
-
url = url_for(api_endpoint_series, pid_value=next_pid_value)
|
|
36
|
-
payload = {
|
|
37
|
-
"next_pid_value": next_pid_value,
|
|
38
|
-
"next_pid_type": next_pid_type,
|
|
39
|
-
"previous_pid_value": previous_pid_value,
|
|
40
|
-
"previous_pid_type": previous_pid_type,
|
|
41
|
-
"relation_type": relation_type,
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
res = client.post(url, headers=json_headers, data=json.dumps(payload))
|
|
45
|
-
assert res.status_code == status_code
|
|
46
|
-
if status_code == 400:
|
|
47
|
-
error = json.loads(res.data.decode("utf-8"))
|
|
48
|
-
assert "message" in error
|
|
49
|
-
assert next_pid_value in error["message"]
|
|
50
|
-
assert previous_pid_value in error["message"]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _test_sequence(client, json_headers):
|
|
54
|
-
"""Test create and delete next and previous relations."""
|
|
55
|
-
next_pid_value = "serid-2"
|
|
56
|
-
next_pid_type = "serid"
|
|
57
|
-
previous_pid_value = "serid-1"
|
|
58
|
-
previous_pid_type = "serid"
|
|
59
|
-
relation_type = "sequence"
|
|
60
|
-
|
|
61
|
-
payload = {
|
|
62
|
-
"next_pid_value": next_pid_value,
|
|
63
|
-
"next_pid_type": next_pid_type,
|
|
64
|
-
"previous_pid_value": previous_pid_value,
|
|
65
|
-
"previous_pid_type": previous_pid_type,
|
|
66
|
-
"relation_type": relation_type,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
def _test_create_sequence(create_using_pid1=True):
|
|
70
|
-
"""Test relation creation of sequence Series."""
|
|
71
|
-
|
|
72
|
-
next_rec, prev_rec = recrel_choose_endpoints_and_do_request(
|
|
73
|
-
(client, json_headers, "POST"),
|
|
74
|
-
(
|
|
75
|
-
next_pid_value,
|
|
76
|
-
next_pid_type,
|
|
77
|
-
previous_pid_value,
|
|
78
|
-
previous_pid_type,
|
|
79
|
-
),
|
|
80
|
-
payload,
|
|
81
|
-
create_using_pid1=create_using_pid1,
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
recrel_assert_record_relations(
|
|
85
|
-
next_rec,
|
|
86
|
-
expected={
|
|
87
|
-
"relations": {
|
|
88
|
-
"sequence": [
|
|
89
|
-
{
|
|
90
|
-
"pid_value": previous_pid_value,
|
|
91
|
-
"pid_type": previous_pid_type,
|
|
92
|
-
"relation_type": "sequence",
|
|
93
|
-
"relation_order": "continues",
|
|
94
|
-
"record_metadata": {
|
|
95
|
-
"title": prev_rec["title"],
|
|
96
|
-
"mode_of_issuance": prev_rec["mode_of_issuance"],
|
|
97
|
-
},
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
recrel_assert_record_relations(
|
|
105
|
-
prev_rec,
|
|
106
|
-
expected={
|
|
107
|
-
"relations": {
|
|
108
|
-
"sequence": [
|
|
109
|
-
{
|
|
110
|
-
"pid_value": next_pid_value,
|
|
111
|
-
"pid_type": next_pid_type,
|
|
112
|
-
"relation_type": "sequence",
|
|
113
|
-
"relation_order": "is_continued_by",
|
|
114
|
-
"record_metadata": {
|
|
115
|
-
"title": next_rec["title"],
|
|
116
|
-
"mode_of_issuance": next_rec["mode_of_issuance"],
|
|
117
|
-
},
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
def _test_delete_sequence(create_using_pid1=True):
|
|
125
|
-
"""Test deletion of sequence relation."""
|
|
126
|
-
|
|
127
|
-
next_rec, prev_rec = recrel_choose_endpoints_and_do_request(
|
|
128
|
-
(client, json_headers, "DELETE"),
|
|
129
|
-
(
|
|
130
|
-
next_pid_value,
|
|
131
|
-
next_pid_type,
|
|
132
|
-
previous_pid_value,
|
|
133
|
-
previous_pid_type,
|
|
134
|
-
),
|
|
135
|
-
payload,
|
|
136
|
-
create_using_pid1=create_using_pid1,
|
|
137
|
-
)
|
|
138
|
-
|
|
139
|
-
recrel_assert_record_relations(next_rec, expected={"relations": {}})
|
|
140
|
-
recrel_assert_record_relations(prev_rec, expected={"relations": {}})
|
|
141
|
-
|
|
142
|
-
_test_create_sequence()
|
|
143
|
-
_test_delete_sequence()
|
|
144
|
-
_test_create_sequence(create_using_pid1=False)
|
|
145
|
-
_test_delete_sequence(create_using_pid1=False)
|
|
146
|
-
# recreate for the next one, to have some more valuable test data
|
|
147
|
-
_test_create_sequence()
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def _test_split_sequence(client, json_headers, testdata):
|
|
151
|
-
"""Test create split next relations."""
|
|
152
|
-
next_pid_type = "serid"
|
|
153
|
-
previous_pid_value = "serid-2"
|
|
154
|
-
previous_pid_type = "serid"
|
|
155
|
-
relation_type = "sequence"
|
|
156
|
-
|
|
157
|
-
payload = {
|
|
158
|
-
"next_pid_type": next_pid_type,
|
|
159
|
-
"previous_pid_value": previous_pid_value,
|
|
160
|
-
"previous_pid_type": previous_pid_type,
|
|
161
|
-
"relation_type": relation_type,
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
# serid-1 from previous test
|
|
165
|
-
rec_serid_1 = get_test_record(testdata, "series", "serid-1")
|
|
166
|
-
serid_1 = {
|
|
167
|
-
"pid_value": "serid-1",
|
|
168
|
-
"pid_type": "serid",
|
|
169
|
-
"relation_type": "sequence",
|
|
170
|
-
"relation_order": "continues",
|
|
171
|
-
"record_metadata": {
|
|
172
|
-
"title": rec_serid_1["title"],
|
|
173
|
-
"mode_of_issuance": rec_serid_1["mode_of_issuance"],
|
|
174
|
-
},
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
def _test_create_split_sequence(create_using_pid1=True):
|
|
178
|
-
"""Test relation creation for split sequence."""
|
|
179
|
-
pid_values = ["serid-3", "serid-4"]
|
|
180
|
-
second_records = []
|
|
181
|
-
|
|
182
|
-
for pid_value in pid_values:
|
|
183
|
-
next_pid_value = pid_value
|
|
184
|
-
payload["next_pid_value"] = pid_value
|
|
185
|
-
next_rec, prev_rec = recrel_choose_endpoints_and_do_request(
|
|
186
|
-
(client, json_headers, "POST"),
|
|
187
|
-
(
|
|
188
|
-
pid_value,
|
|
189
|
-
next_pid_type,
|
|
190
|
-
previous_pid_value,
|
|
191
|
-
previous_pid_type,
|
|
192
|
-
),
|
|
193
|
-
payload,
|
|
194
|
-
create_using_pid1=create_using_pid1,
|
|
195
|
-
)
|
|
196
|
-
second_records.append(
|
|
197
|
-
{
|
|
198
|
-
"pid_value": next_pid_value,
|
|
199
|
-
"pid_type": next_pid_type,
|
|
200
|
-
"relation_type": "sequence",
|
|
201
|
-
"relation_order": "is_continued_by",
|
|
202
|
-
"record_metadata": {
|
|
203
|
-
"title": next_rec["title"],
|
|
204
|
-
"mode_of_issuance": next_rec["mode_of_issuance"],
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
# serid-2
|
|
210
|
-
recrel_assert_record_relations(
|
|
211
|
-
prev_rec,
|
|
212
|
-
expected={"relations": {"sequence": second_records + [serid_1]}},
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
# serid-3 and serid-4
|
|
216
|
-
recrel_assert_record_relations(
|
|
217
|
-
next_rec,
|
|
218
|
-
expected={
|
|
219
|
-
"relations": {
|
|
220
|
-
"sequence": [
|
|
221
|
-
{
|
|
222
|
-
"pid_value": previous_pid_value,
|
|
223
|
-
"pid_type": previous_pid_type,
|
|
224
|
-
"relation_type": "sequence",
|
|
225
|
-
"relation_order": "continues",
|
|
226
|
-
"record_metadata": {
|
|
227
|
-
"title": prev_rec["title"],
|
|
228
|
-
"mode_of_issuance": prev_rec["mode_of_issuance"],
|
|
229
|
-
},
|
|
230
|
-
}
|
|
231
|
-
]
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
_test_create_split_sequence()
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
def test_sequence_relations(client, json_headers, testdata, users):
|
|
240
|
-
"""Test sequence relations."""
|
|
241
|
-
|
|
242
|
-
_test_sequence_invalid_relations_should_fail(
|
|
243
|
-
client,
|
|
244
|
-
json_headers,
|
|
245
|
-
[
|
|
246
|
-
{
|
|
247
|
-
"next_pid_value": "serid-1",
|
|
248
|
-
"next_pid_type": "serid",
|
|
249
|
-
"previous_pid_value": "serid-1",
|
|
250
|
-
"previous_pid_type": "serid",
|
|
251
|
-
"relation_type": "sequence",
|
|
252
|
-
}
|
|
253
|
-
],
|
|
254
|
-
status_code=401,
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
user_login(client, "librarian", users)
|
|
258
|
-
|
|
259
|
-
# serid-1 -> serid-2 (serid-1 is the previous of serid-2)
|
|
260
|
-
_test_sequence(client, json_headers)
|
|
261
|
-
|
|
262
|
-
# serid-4
|
|
263
|
-
# serid-2 (serid-2 is the previous) ->
|
|
264
|
-
# serid-3
|
|
265
|
-
_test_split_sequence(client, json_headers, testdata)
|
|
266
|
-
|
|
267
|
-
invalids = [
|
|
268
|
-
{
|
|
269
|
-
"next_pid_value": "serid-1",
|
|
270
|
-
"next_pid_type": "serid",
|
|
271
|
-
"previous_pid_value": "serid-1",
|
|
272
|
-
"previous_pid_type": "serid",
|
|
273
|
-
"relation_type": "sequence",
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"next_pid_value": "serid-1",
|
|
277
|
-
"next_pid_type": "serid",
|
|
278
|
-
"previous_pid_value": "docid-1",
|
|
279
|
-
"previous_pid_type": "docid",
|
|
280
|
-
"relation_type": "sequence",
|
|
281
|
-
},
|
|
282
|
-
# enable this test when the endpoint will be changed to a generic
|
|
283
|
-
# relations endpoint and not for series only
|
|
284
|
-
# {
|
|
285
|
-
# "next_pid_value": "docid-1",
|
|
286
|
-
# "next_pid_type": "docid",
|
|
287
|
-
# "previous_pid_value": "docid-2",
|
|
288
|
-
# "previous_pid_type": "docid",
|
|
289
|
-
# "relation_type": "sequence",
|
|
290
|
-
# }
|
|
291
|
-
]
|
|
292
|
-
_test_sequence_invalid_relations_should_fail(
|
|
293
|
-
client, json_headers, invalids, status_code=400
|
|
294
|
-
)
|