invenio-app-ils 4.6.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.6.0.dist-info → invenio_app_ils-5.0.0.dist-info}/METADATA +52 -42
  18. {invenio_app_ils-4.6.0.dist-info → invenio_app_ils-5.0.0.dist-info}/RECORD +24 -112
  19. {invenio_app_ils-4.6.0.dist-info → invenio_app_ils-5.0.0.dist-info}/entry_points.txt +3 -0
  20. {invenio_app_ils-4.6.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.6.0.dist-info → invenio_app_ils-5.0.0.dist-info}/WHEEL +0 -0
  114. {invenio_app_ils-4.6.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/AUTHORS.rst +0 -0
  115. {invenio_app_ils-4.6.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,107 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2018 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 accessibility of resource endpoints."""
9
-
10
- import copy
11
- import json
12
-
13
- from flask import url_for
14
-
15
- from tests.helpers import user_login, validate_response
16
-
17
- _HTTP_OK = [200, 201, 204]
18
- ITEM_PID = "itemid-1"
19
- ITEM_ENDPOINT = "invenio_records_rest.pitmid_item"
20
- LIST_ENDPOINT = "invenio_records_rest.pitmid_list"
21
-
22
-
23
- def test_items_permissions(client, testdata, item_record, json_headers, users):
24
- """Test items endpoints permissions."""
25
- dummy_item = copy.deepcopy(item_record)
26
- tests = [
27
- ("admin", _HTTP_OK, dummy_item),
28
- ("librarian", _HTTP_OK, dummy_item),
29
- ("patron1", [403], dummy_item),
30
- ("anonymous", [401], dummy_item),
31
- ]
32
-
33
- def _test_list(expected_status):
34
- """Test get list."""
35
- url = url_for(LIST_ENDPOINT)
36
- res = client.get(url, headers=json_headers)
37
- assert res.status_code in expected_status
38
-
39
- def _test_create(expected_status, data):
40
- """Test record creation."""
41
- url = url_for(LIST_ENDPOINT)
42
- res = client.post(url, headers=json_headers, data=json.dumps(data))
43
- assert res.status_code in expected_status
44
-
45
- if res.status_code < 400:
46
- record = res.get_json()["metadata"]
47
- return record["pid"]
48
-
49
- def _test_update(expected_status, data, pid):
50
- """Test record update."""
51
- pid_value = pid or ITEM_PID
52
- url = url_for(ITEM_ENDPOINT, pid_value=pid_value)
53
- res = client.put(url, headers=json_headers, data=json.dumps(data))
54
- assert res.status_code in expected_status
55
- if res.status_code < 400:
56
- record = res.get_json()["metadata"]
57
-
58
- def _test_read(expected_status, pid):
59
- """Test record read."""
60
- pid_value = pid or ITEM_PID
61
- url = url_for(ITEM_ENDPOINT, pid_value=pid_value)
62
- res = client.get(url, headers=json_headers)
63
- assert res.status_code in expected_status
64
-
65
- def _test_delete(expected_status, pid):
66
- """Test record delete."""
67
- pid_value = pid or ITEM_PID
68
- url = url_for(ITEM_ENDPOINT, pid_value=pid_value)
69
- res = client.delete(url, headers=json_headers)
70
- assert res.status_code in expected_status
71
-
72
- for username, expected_status, data in tests:
73
- user_login(client, username, users)
74
- _test_list(expected_status)
75
- pid = _test_create(expected_status, data)
76
- _test_update(expected_status, data, pid)
77
- _test_read(expected_status, pid)
78
- _test_delete(expected_status, pid)
79
-
80
-
81
- def test_item_circulation(client, json_headers, testdata, users):
82
- """Test item circulation filtering."""
83
-
84
- tests = [
85
- ("patron1", "itemid-56", 403, False),
86
- ("patron2", "itemid-56", 403, True),
87
- ("patron1", "itemid-57", 403, True),
88
- ("patron2", "itemid-57", 403, False),
89
- ("librarian", "itemid-56", 200, False),
90
- ("admin", "itemid-57", 200, False),
91
- ]
92
-
93
- for username, pid, expected_resp_code, filtered in tests:
94
- user_login(client, username, users)
95
- url = url_for("invenio_records_rest.pitmid_item", pid_value=pid)
96
- res = validate_response(
97
- client, "get", url, json_headers, None, expected_resp_code
98
- )
99
- if res.status_code < 400:
100
- circulation = res.json["metadata"]["circulation"]
101
- filter_keys = ["loan_pid", "patron_pid"]
102
- if filtered:
103
- for key in filter_keys:
104
- assert key not in circulation
105
- else:
106
- for key in filter_keys:
107
- assert key in circulation
@@ -1,8 +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
- """Records relations API Tests."""
@@ -1,115 +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
- """Records relations tests helpers."""
9
-
10
- from __future__ import unicode_literals
11
-
12
- import json
13
-
14
- from flask import url_for
15
-
16
- from invenio_app_ils.records_relations.api import RecordRelationsExtraMetadata
17
-
18
- TYPES_ENDPOINTS = {
19
- "relation": {
20
- "docid": "invenio_app_ils_relations.docid_relations",
21
- "serid": "invenio_app_ils_relations.serid_relations",
22
- },
23
- "get": {
24
- "docid": "invenio_records_rest.docid_item",
25
- "serid": "invenio_records_rest.serid_item",
26
- },
27
- }
28
-
29
-
30
- def recrel_fetch_record(client, json_headers, url):
31
- """Fetch a record."""
32
- res = client.get(url_for(url[0], pid_value=url[1]), headers=json_headers)
33
- assert res.status_code == 200
34
- return json.loads(res.data.decode("utf-8"))["metadata"]
35
-
36
-
37
- def recrel_assert_record_relations(record, expected):
38
- """Test extra metadata and `relations` field on parent record."""
39
- extra_metadata_field_name = RecordRelationsExtraMetadata.field_name()
40
- relations_metadata = record.get(extra_metadata_field_name, {})
41
- expected_metadata = expected.get(extra_metadata_field_name, {})
42
-
43
- relations = record.get("relations", {})
44
- expected_relations = expected.get("relations", {})
45
-
46
- assert relations_metadata.keys() == expected_metadata.keys()
47
- for relation, records in relations_metadata.items():
48
- assert len(records) == len(expected_metadata[relation])
49
- for rec in records:
50
- assert rec in expected_metadata[relation]
51
- assert relations.keys() == expected_relations.keys()
52
- for relation, records in relations.items():
53
- assert len(records) == len(expected_relations[relation])
54
- for rec in records:
55
- assert rec in expected_relations[relation]
56
-
57
-
58
- def recrel_do_request_for_valid_relation(
59
- client, json_headers, payload, url, method="POST", expect_status_code=None
60
- ):
61
- """Create a new valid relation."""
62
- func = client.delete if method == "DELETE" else client.post
63
- res = func(
64
- url_for(url[0], pid_value=url[1]),
65
- headers=json_headers,
66
- data=json.dumps(payload),
67
- )
68
- if expect_status_code is None:
69
- expected_status_code = 200 if method == "DELETE" else 201
70
- else:
71
- expected_status_code = expect_status_code
72
- assert res.status_code == expected_status_code
73
- if res.status_code not in [200, 201]:
74
- return
75
- return json.loads(res.data.decode("utf-8"))["metadata"]
76
-
77
-
78
- def recrel_choose_endpoints_and_do_request(
79
- client_params,
80
- relation,
81
- payload,
82
- create_using_pid1=True,
83
- expect_status_code=None,
84
- ):
85
- """Choose which endpoint to use, create relation, return records."""
86
- client, json_headers, method = client_params
87
- pid1, pid1_type, pid2, pid2_type = relation
88
-
89
- if create_using_pid1:
90
- url_create_rel = (TYPES_ENDPOINTS["relation"][pid1_type], pid1)
91
- url_other = (TYPES_ENDPOINTS["get"][pid2_type], pid2)
92
-
93
- record1 = recrel_do_request_for_valid_relation(
94
- client,
95
- json_headers,
96
- payload,
97
- url_create_rel,
98
- method=method,
99
- expect_status_code=expect_status_code,
100
- )
101
- record2 = recrel_fetch_record(client, json_headers, url_other)
102
- else:
103
- url_create_rel = (TYPES_ENDPOINTS["relation"][pid2_type], pid2)
104
- url_other = (TYPES_ENDPOINTS["get"][pid1_type], pid1)
105
-
106
- record2 = recrel_do_request_for_valid_relation(
107
- client,
108
- json_headers,
109
- payload,
110
- url_create_rel,
111
- method=method,
112
- expect_status_code=expect_status_code,
113
- )
114
- record1 = recrel_fetch_record(client, json_headers, url_other)
115
- return record1, record2