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.
Files changed (115) hide show
  1. invenio_app_ils/__init__.py +1 -1
  2. invenio_app_ils/assets/semantic-ui/less/theme.config +103 -0
  3. invenio_app_ils/circulation/api.py +9 -5
  4. invenio_app_ils/circulation/config.py +1 -0
  5. invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py +1 -1
  6. invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +2 -2
  7. invenio_app_ils/circulation/notifications/api.py +9 -1
  8. invenio_app_ils/circulation/notifications/messages.py +2 -1
  9. invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/update_dates.html +19 -0
  10. invenio_app_ils/cli.py +92 -64
  11. invenio_app_ils/config.py +10 -2
  12. invenio_app_ils/documents/loaders/jsonschemas/document.py +1 -1
  13. invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +2 -2
  14. invenio_app_ils/patrons/anonymization.py +0 -4
  15. invenio_app_ils/series/loaders/jsonschemas/series.py +1 -1
  16. invenio_app_ils/webpack.py +27 -0
  17. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/METADATA +56 -43
  18. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/RECORD +24 -112
  19. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/entry_points.txt +3 -0
  20. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/top_level.txt +0 -1
  21. invenio_app_ils/notifications/admin.py +0 -57
  22. tests/__init__.py +0 -8
  23. tests/api/__init__.py +0 -8
  24. tests/api/acquisition/__init__.py +0 -8
  25. tests/api/acquisition/test_acq_orders_crud.py +0 -99
  26. tests/api/acquisition/test_acq_orders_permissions.py +0 -104
  27. tests/api/acquisition/test_acq_providers_permissions.py +0 -83
  28. tests/api/circulation/__init__.py +0 -8
  29. tests/api/circulation/test_expired_loans.py +0 -88
  30. tests/api/circulation/test_loan_bulk_extend.py +0 -169
  31. tests/api/circulation/test_loan_checkout.py +0 -422
  32. tests/api/circulation/test_loan_default_durations.py +0 -43
  33. tests/api/circulation/test_loan_document_resolver.py +0 -18
  34. tests/api/circulation/test_loan_extend.py +0 -122
  35. tests/api/circulation/test_loan_item_permissions.py +0 -135
  36. tests/api/circulation/test_loan_item_resolver.py +0 -26
  37. tests/api/circulation/test_loan_list_permissions.py +0 -98
  38. tests/api/circulation/test_loan_patron_resolver.py +0 -38
  39. tests/api/circulation/test_loan_request.py +0 -338
  40. tests/api/circulation/test_loan_update.py +0 -150
  41. tests/api/circulation/test_notifications.py +0 -221
  42. tests/api/conftest.py +0 -227
  43. tests/api/document_requests/__init__.py +0 -8
  44. tests/api/document_requests/test_document_requests.py +0 -131
  45. tests/api/document_requests/test_document_requests_permissions.py +0 -159
  46. tests/api/document_requests/test_notifications_filter.py +0 -35
  47. tests/api/ill/__init__.py +0 -8
  48. tests/api/ill/test_ill_brw_crud.py +0 -74
  49. tests/api/ill/test_ill_brw_reqs_patron_loan_create_action.py +0 -198
  50. tests/api/ill/test_ill_brw_reqs_patron_loan_extension_actions.py +0 -280
  51. tests/api/ill/test_ill_brw_reqs_permissions.py +0 -163
  52. tests/api/ill/test_ill_providers_permissions.py +0 -82
  53. tests/api/ils/__init__.py +0 -8
  54. tests/api/ils/documents/__init__.py +0 -8
  55. tests/api/ils/documents/test_document_crud.py +0 -57
  56. tests/api/ils/documents/test_document_permissions.py +0 -100
  57. tests/api/ils/documents/test_document_resolvers.py +0 -35
  58. tests/api/ils/eitems/__init__.py +0 -8
  59. tests/api/ils/eitems/test_eitems_crud.py +0 -42
  60. tests/api/ils/eitems/test_eitems_permissions.py +0 -85
  61. tests/api/ils/eitems/test_files.py +0 -162
  62. tests/api/ils/items/__init__.py +0 -8
  63. tests/api/ils/items/test_apis.py +0 -43
  64. tests/api/ils/items/test_items_crud.py +0 -99
  65. tests/api/ils/items/test_items_permissions.py +0 -107
  66. tests/api/ils/records_relations/__init__.py +0 -8
  67. tests/api/ils/records_relations/helpers.py +0 -115
  68. tests/api/ils/records_relations/test_records_relations_parentchild.py +0 -560
  69. tests/api/ils/records_relations/test_records_relations_sequence.py +0 -294
  70. tests/api/ils/records_relations/test_records_relations_siblings.py +0 -751
  71. tests/api/ils/series/__init__.py +0 -8
  72. tests/api/ils/series/test_series_permissions.py +0 -95
  73. tests/api/ils/test_anonymization.py +0 -181
  74. tests/api/ils/test_apis.py +0 -76
  75. tests/api/ils/test_closures.py +0 -353
  76. tests/api/ils/test_errors.py +0 -125
  77. tests/api/ils/test_facets.py +0 -88
  78. tests/api/ils/test_internal_locations.py +0 -96
  79. tests/api/ils/test_loaders.py +0 -51
  80. tests/api/ils/test_metadata_extensions.py +0 -206
  81. tests/api/ils/test_notifications.py +0 -173
  82. tests/api/ils/test_notifications_mails.py +0 -37
  83. tests/api/ils/test_notifications_permissions.py +0 -55
  84. tests/api/ils/test_patrons.py +0 -102
  85. tests/api/ils/test_record_delete.py +0 -42
  86. tests/api/ils/test_record_permissions.py +0 -132
  87. tests/api/ils/test_resolvers.py +0 -205
  88. tests/api/ils/test_stats.py +0 -142
  89. tests/api/ils/test_tasks.py +0 -209
  90. tests/api/ils/test_vocabularies.py +0 -35
  91. tests/conftest.py +0 -221
  92. tests/data/acq_orders.json +0 -110
  93. tests/data/acq_providers.json +0 -12
  94. tests/data/document_requests.json +0 -77
  95. tests/data/documents.json +0 -238
  96. tests/data/eitems.json +0 -71
  97. tests/data/ill_borrowing_requests.json +0 -77
  98. tests/data/ill_providers.json +0 -12
  99. tests/data/internal_locations.json +0 -22
  100. tests/data/items.json +0 -304
  101. tests/data/loans.json +0 -133
  102. tests/data/loans_most_loaned.json +0 -128
  103. tests/data/locations.json +0 -26
  104. tests/data/series.json +0 -33
  105. tests/helpers.py +0 -107
  106. tests/templates/notifications/title_body.html +0 -8
  107. tests/templates/notifications/title_body_html.html +0 -13
  108. tests/templates/notifications/title_body_html_ctx.html +0 -13
  109. tests/templates/notifications/title_only.html +0 -3
  110. tests/test_post_logout_redirect.py +0 -23
  111. tests/test_version.py +0 -17
  112. /tests/templates/notifications/blank.html → /invenio_app_ils/assets/semantic-ui/templates/.gitkeep +0 -0
  113. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/WHEEL +0 -0
  114. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/AUTHORS.rst +0 -0
  115. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,128 +0,0 @@
1
- [
2
- {
3
- "pid": "mostloaned-1",
4
- "document_pid": "docid-1",
5
- "item_pid": {
6
- "type": "pitmid",
7
- "value": "itemid-2"
8
- },
9
- "patron_pid": "1",
10
- "state": "ITEM_RETURNED",
11
- "start_date": "2019-01-02",
12
- "end_date": "2019-02-02",
13
- "transaction_date": "2019-01-02",
14
- "extension_count": 0
15
- },
16
- {
17
- "pid": "mostloaned-2",
18
- "document_pid": "docid-1",
19
- "item_pid": {
20
- "type": "pitmid",
21
- "value": "itemid-2"
22
- },
23
- "patron_pid": "1",
24
- "state": "ITEM_RETURNED",
25
- "start_date": "2019-02-02",
26
- "end_date": "2019-03-02",
27
- "transaction_date": "2019-02-02",
28
- "transaction_location_pid": "1",
29
- "pickup_location_pid": "1",
30
- "extension_count": 0
31
- },
32
- {
33
- "pid": "mostloaned-3",
34
- "document_pid": "docid-1",
35
- "item_pid": {
36
- "type": "pitmid",
37
- "value": "itemid-2"
38
- },
39
- "patron_pid": "1",
40
- "state": "ITEM_RETURNED",
41
- "start_date": "2019-03-02",
42
- "end_date": "2019-04-02",
43
- "transaction_date": "2019-03-02",
44
- "transaction_location_pid": "1",
45
- "pickup_location_pid": "1",
46
- "extension_count": 0
47
- },
48
- {
49
- "pid": "mostloaned-4",
50
- "document_pid": "docid-2",
51
- "item_pid": {
52
- "type": "pitmid",
53
- "value": "itemid-3"
54
- },
55
- "patron_pid": "1",
56
- "state": "ITEM_RETURNED",
57
- "start_date": "2019-02-10",
58
- "end_date": "2019-03-10",
59
- "transaction_date": "2019-02-10",
60
- "transaction_location_pid": "1",
61
- "pickup_location_pid": "1",
62
- "extension_count": 1
63
- },
64
- {
65
- "pid": "mostloaned-5",
66
- "document_pid": "docid-2",
67
- "item_pid": {
68
- "type": "pitmid",
69
- "value": "itemid-3"
70
- },
71
- "patron_pid": "1",
72
- "state": "PENDING",
73
- "start_date": "2019-04-10",
74
- "end_date": "2019-05-10",
75
- "transaction_date": "2019-04-10",
76
- "transaction_location_pid": "1",
77
- "pickup_location_pid": "1",
78
- "extension_count": 1
79
- },
80
- {
81
- "pid": "mostloaned-6",
82
- "document_pid": "docid-3",
83
- "item_pid": {
84
- "type": "pitmid",
85
- "value": "itemid-4"
86
- },
87
- "patron_pid": "1",
88
- "state": "ITEM_RETURNED",
89
- "start_date": "2019-02-20",
90
- "end_date": "2019-03-20",
91
- "transaction_date": "2019-02-20",
92
- "transaction_location_pid": "1",
93
- "pickup_location_pid": "1",
94
- "extension_count": 3
95
- },
96
- {
97
- "pid": "mostloaned-7",
98
- "document_pid": "docid-3",
99
- "item_pid": {
100
- "type": "pitmid",
101
- "value": "itemid-4"
102
- },
103
- "patron_pid": "1",
104
- "state": "ITEM_ON_LOAN",
105
- "start_date": "2019-05-20",
106
- "end_date": "2019-06-20",
107
- "transaction_date": "2019-05-20",
108
- "transaction_location_pid": "1",
109
- "pickup_location_pid": "1",
110
- "extension_count": 3
111
- },
112
- {
113
- "pid": "mostloaned-8",
114
- "document_pid": "docid-5",
115
- "item_pid": {
116
- "type": "pitmid",
117
- "value": "itemid-9"
118
- },
119
- "patron_pid": "1",
120
- "state": "ITEM_RETURNED",
121
- "start_date": "2019-03-07",
122
- "end_date": "2019-04-07",
123
- "transaction_date": "2019-03-07",
124
- "transaction_location_pid": "1",
125
- "pickup_location_pid": "1",
126
- "extension_count": 0
127
- }
128
- ]
tests/data/locations.json DELETED
@@ -1,26 +0,0 @@
1
- [
2
- {
3
- "pid": "locid-1",
4
- "name": "Main Library",
5
- "opening_weekdays": [{"weekday": "monday", "is_open": true}, {"weekday": "tuesday", "is_open": true}, {"weekday": "wednesday", "is_open": true}, {"weekday": "thursday", "is_open": true}, {"weekday": "friday", "is_open": true}, {"weekday": "saturday", "is_open": true}, {"weekday": "sunday", "is_open": true}],
6
- "opening_exceptions": []
7
- },
8
- {
9
- "pid": "locid-2",
10
- "name": "Library of Alexandria",
11
- "opening_weekdays": [{"weekday": "monday", "is_open": true}, {"weekday": "tuesday", "is_open": true}, {"weekday": "wednesday", "is_open": true}, {"weekday": "thursday", "is_open": true}, {"weekday": "friday", "is_open": true}, {"weekday": "saturday", "is_open": true}, {"weekday": "sunday", "is_open": true}],
12
- "opening_exceptions": []
13
- },
14
- {
15
- "pid": "locid-3",
16
- "name": "Library of Alexandria",
17
- "opening_weekdays": [{"weekday": "monday", "is_open": true}, {"weekday": "tuesday", "is_open": true}, {"weekday": "wednesday", "is_open": true}, {"weekday": "thursday", "is_open": true}, {"weekday": "friday", "is_open": true}, {"weekday": "saturday", "is_open": true}, {"weekday": "sunday", "is_open": true}],
18
- "opening_exceptions": []
19
- },
20
- {
21
- "pid": "locid-4",
22
- "name": "Library of Testing",
23
- "opening_weekdays": [{"weekday": "monday", "is_open": true}, {"weekday": "tuesday", "is_open": true}, {"weekday": "wednesday", "is_open": true}, {"weekday": "thursday", "is_open": true}, {"weekday": "friday", "is_open": true}, {"weekday": "saturday", "is_open": false}, {"weekday": "sunday", "is_open": false}],
24
- "opening_exceptions": []
25
- }
26
- ]
tests/data/series.json DELETED
@@ -1,33 +0,0 @@
1
- [
2
- {
3
- "$schema": "https://127.0.0.1:5000/schemas/series/series-v2.0.0.json",
4
- "pid": "serid-1",
5
- "title": "The Gulf: The Making of An American Sea",
6
- "authors": ["Einstein, Albert", "Stachel, John J et al."],
7
- "abstract": "This is a multipart monograph",
8
- "mode_of_issuance": "MULTIPART_MONOGRAPH"
9
- },
10
- {
11
- "$schema": "https://127.0.0.1:5000/schemas/series/series-v2.0.0.json",
12
- "pid": "serid-2",
13
- "title": "The Gulf: The Making of An American Sea",
14
- "authors": ["Banek, Cora", "Banek, Georg"],
15
- "abstract": "This is a multipart monograph",
16
- "mode_of_issuance": "MULTIPART_MONOGRAPH"
17
- },
18
- {
19
- "$schema": "https://127.0.0.1:5000/schemas/series/series-v2.0.0.json",
20
- "pid": "serid-3",
21
- "title": "Springer tracts in modern physics",
22
- "abstract": "This is serial",
23
- "mode_of_issuance": "SERIAL"
24
- },
25
- {
26
- "$schema": "https://127.0.0.1:5000/schemas/series/series-v2.0.0.json",
27
- "pid": "serid-4",
28
- "title": "Dispersion Forces",
29
- "authors": ["Buhmann, Stefan Yoshi"],
30
- "abstract": "This is a multipart monograph",
31
- "mode_of_issuance": "MULTIPART_MONOGRAPH"
32
- }
33
- ]
tests/helpers.py DELETED
@@ -1,107 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2018-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
- """Helpers for tests."""
9
-
10
- import json
11
- import os
12
-
13
- from flask_security import login_user, logout_user
14
- from invenio_accounts.models import User
15
- from invenio_accounts.testutils import login_user_via_session
16
- from invenio_db import db
17
- from invenio_pidstore.models import PersistentIdentifier, PIDStatus
18
-
19
- from invenio_app_ils.items.api import Item
20
-
21
-
22
- def load_json_from_datadir(filename):
23
- """Load JSON from dir."""
24
- _data_dir = os.path.join(os.path.dirname(__file__), "data")
25
- with open(os.path.join(_data_dir, filename), "r") as fp:
26
- return json.load(fp)
27
-
28
-
29
- def mint_record_pid(pid_type, pid_field, record):
30
- """Mint the given PID for the given record."""
31
- PersistentIdentifier.create(
32
- pid_type=pid_type,
33
- pid_value=record[pid_field],
34
- object_type="rec",
35
- object_uuid=record.id,
36
- status=PIDStatus.REGISTERED,
37
- )
38
- db.session.commit()
39
-
40
-
41
- def internal_location_ref_builder(app, item_pid):
42
- """Ref builder for item InternalLocation."""
43
- path = Item._internal_location_resolver_path
44
- return path.format(
45
- scheme=app.config["JSONSCHEMAS_URL_SCHEME"],
46
- host=app.config["JSONSCHEMAS_HOST"],
47
- item_pid=item_pid,
48
- )
49
-
50
-
51
- def document_ref_builder(app, item_pid):
52
- """Ref builder for item Document."""
53
- path = Item._document_resolver_path
54
- return path.format(
55
- scheme=app.config["JSONSCHEMAS_URL_SCHEME"],
56
- host=app.config["JSONSCHEMAS_HOST"],
57
- item_pid=item_pid,
58
- )
59
-
60
-
61
- def user_login(client, username, users):
62
- """Util function to log in user."""
63
- user_logout(client)
64
- if username != "anonymous":
65
- user = User.query.get(users[username].id)
66
- # needed for Identity/Permissions loading
67
- login_user(user, remember=True)
68
- # needed for sessions/http requests
69
- login_user_via_session(client, email=user.email)
70
-
71
- return user
72
-
73
-
74
- def user_logout(client):
75
- """Util function to log out user."""
76
- with client.session_transaction() as sess:
77
- from flask import g
78
-
79
- if "user_id" in sess:
80
- del sess["user_id"]
81
- del sess["_user_id"]
82
- logout_user()
83
-
84
- if "_login_user" in g:
85
- del g._login_user
86
-
87
-
88
- def validate_data(key, expected_output, res):
89
- """Util function for testing output data."""
90
- if res.status_code != 403 and res.status_code != 401:
91
- data = json.loads(res.data.decode("utf-8"))["metadata"]
92
- assert data[key] == expected_output
93
-
94
-
95
- def validate_response(client, req_method, url, headers, data, expected_resp_code):
96
- """Util function testing response code."""
97
- if data:
98
- res = getattr(client, req_method)(url, headers=headers, data=json.dumps(data))
99
- else:
100
- res = getattr(client, req_method)(url, headers=headers)
101
- assert expected_resp_code == res.status_code
102
- return res
103
-
104
-
105
- def get_test_record(testdata, type, pid_value):
106
- """Fetch and return the record from the test data."""
107
- return [rec for rec in testdata[type] if rec["pid"] == pid_value][0]
@@ -1,8 +0,0 @@
1
- {% block title %}
2
- Test title.
3
- {% endblock %}
4
-
5
-
6
- {% block body_plain %}
7
- Test body.
8
- {% endblock %}
@@ -1,13 +0,0 @@
1
- {% block title %}
2
- Test title.
3
- {% endblock %}
4
-
5
-
6
- {% block body_plain %}
7
- Test body.
8
- {% endblock %}
9
-
10
-
11
- {% block body_html %}
12
- Test html.
13
- {% endblock %}
@@ -1,13 +0,0 @@
1
- {% block title %}
2
- Test "{{ title|safe }}" title.
3
- {% endblock %}
4
-
5
-
6
- {% block body_plain %}
7
- Test "{{ title }}" body.
8
- {% endblock %}
9
-
10
-
11
- {% block body_html %}
12
- Test "{{ title }}" html.
13
- {% endblock %}
@@ -1,3 +0,0 @@
1
- {% block title %}
2
- Test title.
3
- {% endblock %}
@@ -1,23 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2022 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
- """Simple test of correct patron redirection after being logged out."""
9
-
10
- from flask import url_for
11
-
12
- from tests.helpers import user_login
13
-
14
-
15
- def test_correct_redirection_after_logout(client, users):
16
- """
17
- Test that a patron is redirected into /logged-out page after logging out.
18
- """
19
- user_login(client, "patron1", users)
20
- res = client.get(url_for("security.logout"), follow_redirects=True)
21
-
22
- assert res.status_code == 200
23
- assert res.request.path == url_for("logged_out.logged_out_view")
tests/test_version.py DELETED
@@ -1,17 +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
- """Simple test of version import."""
9
-
10
- from __future__ import absolute_import, print_function
11
-
12
-
13
- def test_version():
14
- """Test version import."""
15
- from invenio_app_ils import __version__
16
-
17
- assert __version__