invenio-app-ils 4.0.0rc1__py2.py3-none-any.whl → 4.2.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 (29) hide show
  1. invenio_app_ils/__init__.py +2 -2
  2. invenio_app_ils/circulation/config.py +1 -1
  3. invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +2 -1
  4. invenio_app_ils/documents/jsonresolvers/document_stock.py +1 -1
  5. invenio_app_ils/documents/loaders/jsonschemas/document.py +1 -1
  6. invenio_app_ils/documents/mappings/os-v1/documents/document-v2.0.0.json +127 -39
  7. invenio_app_ils/documents/mappings/os-v2/documents/document-v2.0.0.json +127 -39
  8. invenio_app_ils/documents/mappings/v7/documents/document-v2.0.0.json +127 -39
  9. invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +1 -1
  10. invenio_app_ils/items/api.py +13 -1
  11. invenio_app_ils/items/loaders/jsonschemas/items.py +1 -1
  12. invenio_app_ils/items/serializers/item.py +4 -4
  13. invenio_app_ils/permissions.py +43 -35
  14. invenio_app_ils/records/views.py +1 -1
  15. invenio_app_ils/records_relations/api.py +1 -0
  16. invenio_app_ils/relations/api.py +6 -1
  17. invenio_app_ils/series/loaders/jsonschemas/series.py +1 -1
  18. invenio_app_ils/series/mappings/os-v1/series/series-v2.0.0.json +46 -11
  19. invenio_app_ils/series/mappings/os-v2/series/series-v2.0.0.json +46 -11
  20. invenio_app_ils/series/mappings/v7/series/series-v2.0.0.json +46 -11
  21. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/METADATA +69 -58
  22. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/RECORD +28 -29
  23. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/WHEEL +1 -1
  24. tests/api/ils/items/test_items_crud.py +46 -4
  25. tests/api/ils/items/test_items_update.py +0 -40
  26. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/AUTHORS.rst +0 -0
  27. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/LICENSE +0 -0
  28. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/entry_points.txt +0 -0
  29. {invenio_app_ils-4.0.0rc1.dist-info → invenio_app_ils-4.2.0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: invenio-app-ils
3
- Version: 4.0.0rc1
3
+ Version: 4.2.0
4
4
  Summary: Invenio Integrated Library System.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-app-ils
6
6
  Author: CERN
@@ -10,65 +10,62 @@ Keywords: invenio-app-ils Invenio
10
10
  Platform: any
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Requires-Python: >=3.8
13
- Requires-Dist: invenio-app <1.4.0,>=1.3.4
14
- Requires-Dist: invenio-base <1.3.0,>=1.2.11
15
- Requires-Dist: invenio-cache <2.0.0,>=1.1.1
16
- Requires-Dist: invenio-celery <1.3.0,>=1.2.4
17
- Requires-Dist: invenio-config <1.1.0,>=1.0.3
18
- Requires-Dist: invenio-i18n <3.0.0,>=2.0.0
19
- Requires-Dist: invenio-admin <1.5.0,>=1.4.0
20
- Requires-Dist: invenio-assets <4.0.0,>=3.0.0
21
- Requires-Dist: invenio-formatter <3.0.0,>=2.0.0
22
- Requires-Dist: invenio-logging[sentry_sdk] <3.0.0,>=2.0.0
23
- Requires-Dist: invenio-mail <3.0.0,>=2.0.0
24
- Requires-Dist: invenio-rest <1.4.0,>=1.3.0
25
- Requires-Dist: invenio-theme <3.0.0,>=2.0.0
26
- Requires-Dist: invenio-access <3.0.0,>=2.0.0
27
- Requires-Dist: invenio-accounts <4.0.0,>=3.0.0
28
- Requires-Dist: invenio-oauth2server <3.0.0,>=2.0.0
29
- Requires-Dist: invenio-oauthclient <4.0.0,>=3.0.0
30
- Requires-Dist: invenio-userprofiles <1.3.0,>=1.2.4
31
- Requires-Dist: invenio-indexer <3.0.0,>=2.2.0
32
- Requires-Dist: invenio-jsonschemas <1.2.0,>=1.1.4
33
- Requires-Dist: invenio-oaiserver <2.3.0,>=2.2.0
34
- Requires-Dist: invenio-pidstore <1.4.0,>=1.3.0
35
- Requires-Dist: invenio-records-rest <3.0.0,>=2.2.0
36
- Requires-Dist: invenio-records <3.0.0,>=2.2.1
37
- Requires-Dist: invenio-files-rest <3.0.0,>=2.0.0
38
- Requires-Dist: invenio-banners <1.1.0,>=1.0.0a1
39
- Requires-Dist: invenio-pages <1.1.0,>=1.0.0a5
40
- Requires-Dist: invenio-circulation <4.0.0,>=3.0.0a1
41
- Requires-Dist: invenio-opendefinition <3.0.0,>=2.0.0a1
42
- Requires-Dist: invenio-pidrelations <1.1.0,>=0.2.0
43
- Requires-Dist: invenio-stats <5.0.0,>=4.0.0
44
- Requires-Dist: Flask-Debugtoolbar <1.0.0,>=0.10.1
45
- Requires-Dist: pycountry <23.0.0,>=20.0.0
46
- Requires-Dist: simplejson <4.0.0,>=3.8.1
47
- Requires-Dist: pluggy <1.0.0,>=0.13.1
48
- Requires-Dist: jsonschema <5.0.0,>=4.3.0
49
- Requires-Dist: itsdangerous <2.1,>=1.1
50
- Requires-Dist: SQLAlchemy <2.0.0,>=1.3.0
51
- Requires-Dist: Flask <2.3.0,>=2.2.0
52
- Requires-Dist: Werkzeug <2.3.0,>=2.2.0
13
+ License-File: LICENSE
14
+ License-File: AUTHORS.rst
15
+ Requires-Dist: invenio-app<1.4.0,>=1.3.4
16
+ Requires-Dist: invenio-db[mysql,postgresql]<2.0.0,>=1.0.14
17
+ Requires-Dist: invenio-base<1.3.0,>=1.2.11
18
+ Requires-Dist: invenio-cache<2.0.0,>=1.1.1
19
+ Requires-Dist: invenio-celery<1.3.0,>=1.2.4
20
+ Requires-Dist: invenio-config<1.1.0,>=1.0.3
21
+ Requires-Dist: invenio-i18n<3.0.0,>=2.0.0
22
+ Requires-Dist: invenio-admin<1.5.0,>=1.4.0
23
+ Requires-Dist: invenio-assets<4.0.0,>=3.0.0
24
+ Requires-Dist: invenio-formatter<3.0.0,>=2.0.0
25
+ Requires-Dist: invenio-logging[sentry_sdk]<3.0.0,>=2.0.0
26
+ Requires-Dist: invenio-mail<3.0.0,>=2.0.0
27
+ Requires-Dist: invenio-rest<1.4.0,>=1.3.0
28
+ Requires-Dist: invenio-theme<3.0.0,>=2.0.0
29
+ Requires-Dist: invenio-access<3.0.0,>=2.0.0
30
+ Requires-Dist: invenio-accounts<4.0.0,>=3.0.0
31
+ Requires-Dist: invenio-oauth2server<3.0.0,>=2.0.0
32
+ Requires-Dist: invenio-oauthclient<4.0.0,>=3.0.0
33
+ Requires-Dist: invenio-userprofiles<1.3.0,>=1.2.4
34
+ Requires-Dist: invenio-indexer<3.0.0,>=2.2.0
35
+ Requires-Dist: invenio-jsonschemas<1.2.0,>=1.1.4
36
+ Requires-Dist: invenio-oaiserver<2.3.0,>=2.2.0
37
+ Requires-Dist: invenio-pidstore<1.4.0,>=1.3.0
38
+ Requires-Dist: invenio-records-rest<3.0.0,>=2.2.0
39
+ Requires-Dist: invenio-records<3.0.0,>=2.2.1
40
+ Requires-Dist: invenio-files-rest<3.0.0,>=2.0.0
41
+ Requires-Dist: invenio-banners<1.1.0,>=1.0.0a1
42
+ Requires-Dist: invenio-pages<1.1.0,>=1.0.0a5
43
+ Requires-Dist: invenio-circulation<4.0.0,>=3.0.0a1
44
+ Requires-Dist: invenio-opendefinition<3.0.0,>=2.0.0a1
45
+ Requires-Dist: invenio-pidrelations<1.1.0,>=0.2.0
46
+ Requires-Dist: invenio-stats<5.0.0,>=4.0.0
47
+ Requires-Dist: Flask-Debugtoolbar<1.0.0,>=0.10.1
48
+ Requires-Dist: pycountry<23.0.0,>=20.0.0
49
+ Requires-Dist: simplejson<4.0.0,>=3.8.1
50
+ Requires-Dist: pluggy<1.0.0,>=0.13.1
51
+ Requires-Dist: jsonschema<5.0.0,>=4.3.0
52
+ Requires-Dist: itsdangerous<2.1,>=1.1
53
+ Requires-Dist: SQLAlchemy<2.0.0,>=1.3.0
54
+ Requires-Dist: Flask<2.3.0,>=2.2.0
55
+ Requires-Dist: Werkzeug<2.3.0,>=2.2.0
53
56
  Provides-Extra: docs
54
57
  Provides-Extra: lorem
55
- Requires-Dist: lorem >=0.1.1 ; extra == 'lorem'
56
- Provides-Extra: mysql
57
- Requires-Dist: invenio-db[mysql,versioning] <2.0.0,>=1.0.14 ; extra == 'mysql'
58
+ Requires-Dist: lorem>=0.1.1; extra == "lorem"
58
59
  Provides-Extra: opensearch2
59
- Requires-Dist: invenio-search[opensearch2] <3.0.0,>=2.0.0 ; extra == 'opensearch2'
60
- Provides-Extra: postgresql
61
- Requires-Dist: invenio-db[postgresql,versioning] <2.0.0,>=1.0.14 ; extra == 'postgresql'
62
- Provides-Extra: sqlite
63
- Requires-Dist: invenio-db[versioning] <2.0.0,>=1.0.14 ; extra == 'sqlite'
60
+ Requires-Dist: invenio-search[opensearch2]<3.0.0,>=2.0.0; extra == "opensearch2"
64
61
  Provides-Extra: tests
65
- Requires-Dist: pytest-black >=0.3.0 ; extra == 'tests'
66
- Requires-Dist: mock >=2.0.0 ; extra == 'tests'
67
- Requires-Dist: pytest-invenio <3.0.0,>=2.0.0 ; extra == 'tests'
68
- Requires-Dist: docker-services-cli >=0.6.0 ; extra == 'tests'
69
- Requires-Dist: pydocstyle ==6.1.1 ; extra == 'tests'
70
- Requires-Dist: pytest-mock >=1.6.0 ; extra == 'tests'
71
- Requires-Dist: sphinx >=5 ; extra == 'tests'
62
+ Requires-Dist: pytest-black>=0.3.0; extra == "tests"
63
+ Requires-Dist: mock>=2.0.0; extra == "tests"
64
+ Requires-Dist: pytest-invenio<3.0.0,>=2.0.0; extra == "tests"
65
+ Requires-Dist: docker-services-cli>=0.6.0; extra == "tests"
66
+ Requires-Dist: pydocstyle==6.1.1; extra == "tests"
67
+ Requires-Dist: pytest-mock>=1.6.0; extra == "tests"
68
+ Requires-Dist: sphinx>=5; extra == "tests"
72
69
 
73
70
  ..
74
71
  Copyright (C) 2018-2020 CERN.
@@ -96,7 +93,7 @@ https://invenioils.docs.cern.ch
96
93
 
97
94
 
98
95
  ..
99
- Copyright (C) 2018-2022 CERN.
96
+ Copyright (C) 2018-2024 CERN.
100
97
 
101
98
  invenio-app-ils is free software; you can redistribute it and/or modify it
102
99
  under the terms of the MIT License; see LICENSE file for more details.
@@ -104,6 +101,20 @@ https://invenioils.docs.cern.ch
104
101
  Changes
105
102
  =======
106
103
 
104
+ Version 4.2.0 (released 2024-11-04)
105
+
106
+ - self-checkout: barcode is now always uppercased to make searches case-insensitive
107
+
108
+ Version 4.1.0 (released 2024-10-21)
109
+
110
+ - search: apply the same search analyzers to the fields that needs to be searchable.
111
+ This is required when using cross-field searches.
112
+ Re-create the documents and series indices to take advantage of this change.
113
+
114
+ Version 4.0.0 (released 2024-08-07)
115
+
116
+ - Initial full release
117
+
107
118
  Version 4.0.0rc1 (released 2024-06-28)
108
119
 
109
120
  - search: improve search for accents and special characters
@@ -141,7 +152,7 @@ Version 2.0.0rc9 (released 2024-04-25)
141
152
  Version 2.0.0rc8 (released 2024-04-04)
142
153
 
143
154
  - records_relation: Simplify sorting
144
- - records_relations: Use sort_by paramemter from configs instead
155
+ - records_relations: Use sort_by parameter from configs instead
145
156
  - relations: Add functionality to sort json refs by relation_type
146
157
  - tests: circulation: Add new location for testing closures
147
158
  - circulation: loan_request: Fix dates comparison in get_offset_duration
@@ -1,4 +1,4 @@
1
- invenio_app_ils/__init__.py,sha256=G14OojgIuJMGf9uALhEyN9bu0o0_WJmdNIuQtLguDGs,288
1
+ invenio_app_ils/__init__.py,sha256=BG7JkbyAvqXyUKbb3oLeYr_yMXjp_IyeBWbEWEVKyWY,285
2
2
  invenio_app_ils/cli.py,sha256=wD-SSrkbEhsndI7N9E39p-T1MXj8LR8pvsWFH-JHHVA,57478
3
3
  invenio_app_ils/config.py,sha256=b-3nNceV4s93eS-AS3WEj9eMopROa2hEZ7BI5jDnlAg,40857
4
4
  invenio_app_ils/errors.py,sha256=eXG53KxCnoC0KH9xAjHbu-U2zIsJG28GNPn9PwLTEfk,10486
@@ -7,7 +7,7 @@ invenio_app_ils/facets.py,sha256=x-ID7vL34zqbxJi7VC3EJSee13l_Jk0CfPZN3RHZrM8,420
7
7
  invenio_app_ils/fetchers.py,sha256=GY5A6BXaqMB9HKvJuTcio3JYoF15t6eqMo3yzQKTqac,520
8
8
  invenio_app_ils/indexer.py,sha256=ngXRx2liufDzgsSIoCeusk6q0Y1uskQ3QiVLeAi3KRg,2212
9
9
  invenio_app_ils/minters.py,sha256=8JW-45fL9Oy_13eZjlk8kL_12jJGZK59qbKlCeseQgA,537
10
- invenio_app_ils/permissions.py,sha256=Uj8QUvCNkh7imfZEgZU6VXezrwKQVZBYzipnfZbS58o,6759
10
+ invenio_app_ils/permissions.py,sha256=fW1svDhawp1BfkG_ynvSzJxeN3ea_gPz8-NCr1ICiHc,6859
11
11
  invenio_app_ils/proxies.py,sha256=IGBwXQSOxpXHjD8PWFG1nqUm70xGAgzWT8Y0AKdCGiI,453
12
12
  invenio_app_ils/search_permissions.py,sha256=KxkzgzSz3yabcDMffrsQag4TqZac0w1TBzntb7zjmOQ,5058
13
13
  invenio_app_ils/signals.py,sha256=KaN8yQUVq-2O2IKQQvPLtMjqp1S3AU1LYPlRyw9U8Pg,395
@@ -36,7 +36,7 @@ invenio_app_ils/acquisition/schemas/__init__.py,sha256=HulLvvDz0W5owDGxVLIaastuZ
36
36
  invenio_app_ils/acquisition/schemas/acq_orders/order-v1.0.0.json,sha256=_Kd3oX_7gJJQSqSc2TxQulXletYu0wEeTdQKkXr7kLs,5688
37
37
  invenio_app_ils/circulation/__init__.py,sha256=Gd0KAsGdhPdz0ACEQ9k8xSeOIxZr3xRK_FiE8U3RQWs,248
38
38
  invenio_app_ils/circulation/api.py,sha256=so7YAlzXoO46nMwnXiKoaGgsQHr4OXwOJeUKYe88p0w,11220
39
- invenio_app_ils/circulation/config.py,sha256=VbRT8DDM-8Drtk333CF-7N67AA6YF9oBOEtcB8oxacE,10988
39
+ invenio_app_ils/circulation/config.py,sha256=ZVRFTgn8ZV_ku4nA_GAlyIYc10F-6mpekKiGqF5y_Eo,10988
40
40
  invenio_app_ils/circulation/indexer.py,sha256=T24J5QqcB38LRJgirkAXL2tmFOucYToDRegxgFW96ag,3887
41
41
  invenio_app_ils/circulation/receivers.py,sha256=Ux6KTNbII3DHBvCUS0gxqbi6tNbm76_kbcaHtK0BsB4,2488
42
42
  invenio_app_ils/circulation/search.py,sha256=l9DAr9uoaF_JbfiiXVpAFKW3NLv9bgs7D-uDwtU-fv0,6105
@@ -51,7 +51,7 @@ invenio_app_ils/circulation/loaders/schemas/json/__init__.py,sha256=wsV4twVnMDNW
51
51
  invenio_app_ils/circulation/loaders/schemas/json/base.py,sha256=lkOTJT6pPbukEjwVXEDaFxA7ruslxO3WyQlNuQpiv-U,1444
52
52
  invenio_app_ils/circulation/loaders/schemas/json/bulk_extend.py,sha256=nDqWF2cwiO2GHwPVO6ivPIya6g2AHQ-pZnQoo9e9fQs,638
53
53
  invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py,sha256=ijIJ-SLgKOutuGrNtWerB9OmIfk7nVPCoFlaocBhUFg,2147
54
- invenio_app_ils/circulation/loaders/schemas/json/loan_request.py,sha256=jlbtdck6FoG7bK5UjLqc-LFka3kUBBURRVcM-ZRyZW4,5920
54
+ invenio_app_ils/circulation/loaders/schemas/json/loan_request.py,sha256=iJVAnyNE1_LfVTuiO_yNtLVMOKHm0OErRbqU4uhczbU,5921
55
55
  invenio_app_ils/circulation/loaders/schemas/json/loan_update_dates.py,sha256=9NtrBJKytly3Acv4wxuqExN0gB9DGnXB8K_27izQkrs,774
56
56
  invenio_app_ils/circulation/notifications/__init__.py,sha256=fG45An4FOBrAIZcWfFtv-3RnyFC4lfHUXWdwy164y_Q,246
57
57
  invenio_app_ils/circulation/notifications/api.py,sha256=UxGle0HgDU5PA7TeS4wVThybrBurOTWGvH_QKSP5Pyg,3429
@@ -122,20 +122,20 @@ invenio_app_ils/documents/jsonresolvers/document_circulation.py,sha256=qwfP9h8R4
122
122
  invenio_app_ils/documents/jsonresolvers/document_eitem.py,sha256=bMLjQlBnsynuKqAdvUmbAe18duI76nqlt-LsGjBu90w,1827
123
123
  invenio_app_ils/documents/jsonresolvers/document_item.py,sha256=gQaXJ2ebEG9uH_sm4iz34M228_tUJEmferpU5u0clZQ,3204
124
124
  invenio_app_ils/documents/jsonresolvers/document_relations.py,sha256=D2VBBK_5hqKwefmoN7lq13oqKcjeRoHohVKQ83HhHkM,1138
125
- invenio_app_ils/documents/jsonresolvers/document_stock.py,sha256=aoSd1ypYt1TgUlc6H6PnTyY9kwm4A5YhqjqVYbwFDcU,1668
125
+ invenio_app_ils/documents/jsonresolvers/document_stock.py,sha256=QQ1WNsHBqzLoxRngK2uyFcqPVCXwLqj4Ayn23dyF7YM,1668
126
126
  invenio_app_ils/documents/loaders/__init__.py,sha256=h_uilf6ka1qi9vwhfDc5SzL1rdWHH2qWCMQrI_LEnoU,414
127
127
  invenio_app_ils/documents/loaders/jsonschemas/__init__.py,sha256=3RyVNmovfMJnmze6_QKSULev8a3yRHUCuO-0y3UFy64,238
128
- invenio_app_ils/documents/loaders/jsonschemas/document.py,sha256=RXemA7NAQvd1qpdGwZcmYoJ3-9G35yxslsL8IRRxb5Q,7577
128
+ invenio_app_ils/documents/loaders/jsonschemas/document.py,sha256=TmnI6QKR1tl-7MAHZGefiuTxCnt81Ikysm4roCsxDvM,7577
129
129
  invenio_app_ils/documents/mappings/__init__.py,sha256=8myTYxQP-EadjBbmAQd3vjZY1-uUGpSQCDv7Sr2cX6A,229
130
130
  invenio_app_ils/documents/mappings/os-v1/__init__.py,sha256=0TRJl_WtkxFUNK3MxyntNg2s-lZILhzB2ZdKMs7qcDI,241
131
131
  invenio_app_ils/documents/mappings/os-v1/documents/document-v1.0.0.json,sha256=o864rRsme4OKA7SwQhpc2ORO5VflH2hpF-58GssfdqA,21646
132
- invenio_app_ils/documents/mappings/os-v1/documents/document-v2.0.0.json,sha256=xP-8MtzJBQ0neHqS_yRYClJiffe_KMub1Layba7WZ2w,23192
132
+ invenio_app_ils/documents/mappings/os-v1/documents/document-v2.0.0.json,sha256=MwIGJS3kQG_RXrq4fDxZT55Gtsj2z16vQipWkBu2-00,25806
133
133
  invenio_app_ils/documents/mappings/os-v2/__init__.py,sha256=0TRJl_WtkxFUNK3MxyntNg2s-lZILhzB2ZdKMs7qcDI,241
134
134
  invenio_app_ils/documents/mappings/os-v2/documents/document-v1.0.0.json,sha256=o864rRsme4OKA7SwQhpc2ORO5VflH2hpF-58GssfdqA,21646
135
- invenio_app_ils/documents/mappings/os-v2/documents/document-v2.0.0.json,sha256=xP-8MtzJBQ0neHqS_yRYClJiffe_KMub1Layba7WZ2w,23192
135
+ invenio_app_ils/documents/mappings/os-v2/documents/document-v2.0.0.json,sha256=MwIGJS3kQG_RXrq4fDxZT55Gtsj2z16vQipWkBu2-00,25806
136
136
  invenio_app_ils/documents/mappings/v7/__init__.py,sha256=0TRJl_WtkxFUNK3MxyntNg2s-lZILhzB2ZdKMs7qcDI,241
137
137
  invenio_app_ils/documents/mappings/v7/documents/document-v1.0.0.json,sha256=o864rRsme4OKA7SwQhpc2ORO5VflH2hpF-58GssfdqA,21646
138
- invenio_app_ils/documents/mappings/v7/documents/document-v2.0.0.json,sha256=xP-8MtzJBQ0neHqS_yRYClJiffe_KMub1Layba7WZ2w,23192
138
+ invenio_app_ils/documents/mappings/v7/documents/document-v2.0.0.json,sha256=MwIGJS3kQG_RXrq4fDxZT55Gtsj2z16vQipWkBu2-00,25806
139
139
  invenio_app_ils/documents/schemas/__init__.py,sha256=ngcwrP0RQpnFmW2WG5ZANoPw3A1AblqFF6eiAPny1iw,234
140
140
  invenio_app_ils/documents/schemas/documents/document-v1.0.0.json,sha256=uhtuj4PxrM4AkZUv-2_8CsXUYd8MMY_Cizbov1QZCp4,18138
141
141
  invenio_app_ils/documents/schemas/documents/document-v2.0.0.json,sha256=uhtuj4PxrM4AkZUv-2_8CsXUYd8MMY_Cizbov1QZCp4,18138
@@ -148,7 +148,7 @@ invenio_app_ils/eitems/jsonresolvers/eitem_document.py,sha256=dgs0yGqHlfOL00jIJn
148
148
  invenio_app_ils/eitems/jsonresolvers/eitem_files.py,sha256=xCAIL4HGXAGhovxbNLAWz9ra_CsWZ4UpsNzK3VaddKw,1358
149
149
  invenio_app_ils/eitems/loaders/__init__.py,sha256=F3-_mbd-3Pjr8J20gVEDxGs3VE9nMEKChp03LjLi-Uo,401
150
150
  invenio_app_ils/eitems/loaders/jsonschemas/__init__.py,sha256=6bLAkym3u9rgqYTHDHOX3gr5Hh60QNC_YHQMkzIHDgY,236
151
- invenio_app_ils/eitems/loaders/jsonschemas/eitems.py,sha256=nGnT-HOy4veHbg4ffrAWEw5WSKWvured_OfJQEqc2B8,2063
151
+ invenio_app_ils/eitems/loaders/jsonschemas/eitems.py,sha256=KKUe1QvjZ7z6Swtbi2D1vxBiv_55suIXbQYM4E0tJLs,2063
152
152
  invenio_app_ils/eitems/mappings/__init__.py,sha256=PXpNWKcHerg4WIVNBjag0iCPZRQ8pyb3PyxT9zcrnvc,236
153
153
  invenio_app_ils/eitems/mappings/os-v1/__init__.py,sha256=99ifBNKeEw3npzw0AOKCUTP25mcR2Sn1M7Oy8i_Ra_A,239
154
154
  invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v1.0.0.json,sha256=MBWhA2wJl8t9q12Rc90pwRkTp0Rk8uSPfZWWWDUabDA,2756
@@ -224,7 +224,7 @@ invenio_app_ils/internal_locations/mappings/v7/internal_locations/internal_locat
224
224
  invenio_app_ils/internal_locations/schemas/__init__.py,sha256=gMsPU0b91BaEF60VR_sY6eWLR-BLkkNSldzIdlsyPBA,244
225
225
  invenio_app_ils/internal_locations/schemas/internal_locations/internal_location-v1.0.0.json,sha256=MgGTxIq64uEGryvEyN5EXSORm9lZoE4MHj4ZLaBqr18,1115
226
226
  invenio_app_ils/items/__init__.py,sha256=Jdz0wSG1rNZyyit0VynCMQVDUHo0Vv1S3A2V-PICDfU,226
227
- invenio_app_ils/items/api.py,sha256=xbjklZI1D605VucninFt4AA3bPsKk_md043_Toa__N4,7413
227
+ invenio_app_ils/items/api.py,sha256=olr3T84QU9qVkmXnKgjIg7DIRQGwKRUfPfyaAjW_kwg,7838
228
228
  invenio_app_ils/items/indexer.py,sha256=vWxOnw6o_zH9gDHex4gWrDClP8H2UMyCcrJnxhxjsaU,2022
229
229
  invenio_app_ils/items/search.py,sha256=eyEsQNhMvj-DeYMQRgEsyDn4H0AxqxyMIzPMg6prbIY,2985
230
230
  invenio_app_ils/items/jsonresolvers/__init__.py,sha256=bS7v-bpbyHNrqtY9n5SkDJDcfi9jqOUZYVjjrd9qyy0,244
@@ -233,7 +233,7 @@ invenio_app_ils/items/jsonresolvers/item_internal_location.py,sha256=FKPaEfI8urk
233
233
  invenio_app_ils/items/jsonresolvers/item_loan.py,sha256=RZQP5zvM2lcuAhxQbFlhJJJyxQeNV-ZUE2tMojBApeY,1630
234
234
  invenio_app_ils/items/loaders/__init__.py,sha256=MLPgoiiMW5_7HLacJ4ny3vmmih3qOLA2-5ECPWWwZvg,424
235
235
  invenio_app_ils/items/loaders/jsonschemas/__init__.py,sha256=QjB4GpaGRO8_vUf5F2Igu-VBtCJOrxBBAcyhMYp2uLc,235
236
- invenio_app_ils/items/loaders/jsonschemas/items.py,sha256=Cwi9YmBrYLPMWLpvGelbAhLkfDiWjPbM2JR1QNA_8e0,2073
236
+ invenio_app_ils/items/loaders/jsonschemas/items.py,sha256=vkktlcwZOXhKtZM0ttPUOHFpIJ3eZUIuqg7WeYiZ56k,2073
237
237
  invenio_app_ils/items/mappings/__init__.py,sha256=FHHOdSZAxfKT7lwBTyho9e9H5_MQ5iSJegK9REtcJjY,235
238
238
  invenio_app_ils/items/mappings/os-v1/__init__.py,sha256=d3ZUL6aicw4_MYvaJ3AI5a8vnoEwaSwM5YUDDOgooVg,238
239
239
  invenio_app_ils/items/mappings/os-v1/items/item-v1.0.0.json,sha256=cqSMIOFW7VsuS1FHjsQ0Hy-NuvnYEKhGyaBWM4epP6E,6352
@@ -248,7 +248,7 @@ invenio_app_ils/items/schemas/__init__.py,sha256=oH3ip8OnA1mK1eM3gp8VxEM5LLoSVSW
248
248
  invenio_app_ils/items/schemas/items/item-v1.0.0.json,sha256=kEn3c45Dk_OSJnuRtwJpThUp9WKC_FvBsTr6DcUIqTQ,3960
249
249
  invenio_app_ils/items/schemas/items/item-v2.0.0.json,sha256=kEn3c45Dk_OSJnuRtwJpThUp9WKC_FvBsTr6DcUIqTQ,3960
250
250
  invenio_app_ils/items/serializers/__init__.py,sha256=OxfwU0rGarUnBvznMmiGaJx6uMwX-062pN9RQwR2lhw,914
251
- invenio_app_ils/items/serializers/item.py,sha256=d9TzdYLhpRfp4VyoBdNuYTqQWkshytAk3Q8YUI1E6ms,2967
251
+ invenio_app_ils/items/serializers/item.py,sha256=8qHJp4SFxJj_qM-Pf-Om98KYc5ytweNLJiD94ksGslQ,2967
252
252
  invenio_app_ils/literature/__init__.py,sha256=GELxzVtOq8G2O7Uvs_mLsj0wPnS5l-6ns9mLFDGMEmQ,231
253
253
  invenio_app_ils/literature/api.py,sha256=gbLMK36fN0KXUmygRLadeejPnJ_3CSU_8WFrgxwQ_j4,862
254
254
  invenio_app_ils/literature/covers_builder.py,sha256=_MzoKZik_7UZRKl8szuhcLSD-o8reRSyV8VSbcIbh8g,1285
@@ -323,7 +323,7 @@ invenio_app_ils/records/listeners.py,sha256=6_yZRDh17ujY5zz3gSCArJeId9r8vyo-yadW
323
323
  invenio_app_ils/records/metadata_extensions.py,sha256=Y7knwqFTZ6UQU6-Viuhv22cplGd9VsebXasoDB-o39o,3599
324
324
  invenio_app_ils/records/permissions.py,sha256=_0zd1GCbulcSEGLZ3ZJBaD8Q-TU1r9XLlGLByj-TqCw,3773
325
325
  invenio_app_ils/records/receivers.py,sha256=z9iEd9EMqVw5wS3_pPZTZzeKRyzOguTHqb8FgsKCoD0,493
326
- invenio_app_ils/records/views.py,sha256=Ds4_Fx_YvEVknNoqfpQFyOYf305k6EtkzXLGnojybyg,3410
326
+ invenio_app_ils/records/views.py,sha256=RGdt3ZQOrfvNxuEfv31Dk-udsRG2u_8J73Sb7fiD8m8,3410
327
327
  invenio_app_ils/records/jsonresolvers/__init__.py,sha256=mhHgwyehRSGfoWcfTT9O7F5pCFoS7-yKwJkbFaYRF8Y,249
328
328
  invenio_app_ils/records/jsonresolvers/api.py,sha256=RAM7bqEjqgTn3wx6PlDRY_UEjZknrXiMSB-dMOJwvW0,1183
329
329
  invenio_app_ils/records/loaders/__init__.py,sha256=saCzmtbFLKrgmueTclBSikDwO56XVpHA07PZ_dKu4Bo,817
@@ -336,12 +336,12 @@ invenio_app_ils/records/schemas/__init__.py,sha256=K6l2nVL1zpZM9ZFfZQBgHsjeiSTsk
336
336
  invenio_app_ils/records/schemas/json.py,sha256=r7wShFjJ3FnT_pvunyqfWbgJf9z9iaUV3MhyTEtbEyw,712
337
337
  invenio_app_ils/records/serializers/__init__.py,sha256=pomP0H0b3Zku8lWWcFu86ondB-RJWzO1gDO8mDVEKgo,2230
338
338
  invenio_app_ils/records_relations/__init__.py,sha256=fLycCnrsQv6yVQPARUjHW5QAXcAH7d1dp_dDChQyzFY,238
339
- invenio_app_ils/records_relations/api.py,sha256=2TvOyfwBC5sDVCWX_MUnqlmll53_qXEgSlKb8EQNwKo,16763
339
+ invenio_app_ils/records_relations/api.py,sha256=m2MlN1qS53QtrdqZI8KzRS1bO-0u11QV4z2OcmOFLzI,16764
340
340
  invenio_app_ils/records_relations/indexer.py,sha256=xlNQ6jRKTSrTXX5l0mnbx7kNkfwHeJlw70KsDSqGBeU,2279
341
341
  invenio_app_ils/records_relations/retriever.py,sha256=_PcbdG1IM_hss7xqClvK8Ti-0pB8rBgfOM5GgJvHrNM,8944
342
342
  invenio_app_ils/records_relations/views.py,sha256=-YLUhhSk2oI75RvueAgCxi5L_CafhlsgnNvbePBjobs,14889
343
343
  invenio_app_ils/relations/__init__.py,sha256=K27Ys3WJwwhJp5NnD9RZDbLMIKu_OcOXZWfSTBpcTOY,229
344
- invenio_app_ils/relations/api.py,sha256=2fBGdUJZ9nRnhyr7uy0YlkZJve1jD-qDQMTcJcOEUE8,14074
344
+ invenio_app_ils/relations/api.py,sha256=IDG_6xWv8Mun40csBWuPNXkzRNdaO9wLe1otWquriig,14105
345
345
  invenio_app_ils/relations/nodes.py,sha256=PE_D6gj335EH_G1BWPGEKZOCzrIOII5UpN4a5-MpxcA,376
346
346
  invenio_app_ils/series/__init__.py,sha256=kd4lghqtrIci0-JaTmSIv0kT5DhaydNi5mBh93_x4iw,227
347
347
  invenio_app_ils/series/api.py,sha256=pbFUiOXsR86sN1Shb0eOBIb3EY6zstby4yRXofcQtdQ,3235
@@ -351,17 +351,17 @@ invenio_app_ils/series/jsonresolvers/__init__.py,sha256=KwS1i7XJkydP_YfOMjjvCXbn
351
351
  invenio_app_ils/series/jsonresolvers/series_relations.py,sha256=-QhlHVl93TddK6tsqxyYb3xvp3ISRA9dHa-qz_ZTFW4,1097
352
352
  invenio_app_ils/series/loaders/__init__.py,sha256=2tEAlF_GRq-2-eLXd8e8w4e19iBBZs98E3_nwPQiqlY,404
353
353
  invenio_app_ils/series/loaders/jsonschemas/__init__.py,sha256=h5J1d56DTizrKCfQHHO7d8OH0tno3hb_-dtaKkB63_Y,236
354
- invenio_app_ils/series/loaders/jsonschemas/series.py,sha256=MVOkGUTK02-6lm26sd218W6JfBRS4n939BgImNGeKuI,4110
354
+ invenio_app_ils/series/loaders/jsonschemas/series.py,sha256=K8Z0Bl8wtSxcDCFC1lPGhGPMHdoCPmwvygEDhbaZJeA,4110
355
355
  invenio_app_ils/series/mappings/__init__.py,sha256=A7EmmTOx0yXlMkeimLxvL5xTlwBy3ogbNVRXU8E7bF8,236
356
356
  invenio_app_ils/series/mappings/os-v1/__init__.py,sha256=1Fny1TaeM8uc9Rwvw2bf94RvxEY067R5nP5Lz17UEGs,239
357
357
  invenio_app_ils/series/mappings/os-v1/series/series-v1.0.0.json,sha256=YJLsKB5xjk2IIX8V39tp-1W03r3Vq96c7Ubr_fk1AWA,6919
358
- invenio_app_ils/series/mappings/os-v1/series/series-v2.0.0.json,sha256=_adu2g4XAy_lzfSpBfBMxcZDnnUG1NUXcHORI2VvVoo,7801
358
+ invenio_app_ils/series/mappings/os-v1/series/series-v2.0.0.json,sha256=OzuSTg1RkGk2ulRyl2aeAIpZrTnb5AQedMPYih5o8Q0,9082
359
359
  invenio_app_ils/series/mappings/os-v2/__init__.py,sha256=1Fny1TaeM8uc9Rwvw2bf94RvxEY067R5nP5Lz17UEGs,239
360
360
  invenio_app_ils/series/mappings/os-v2/series/series-v1.0.0.json,sha256=YJLsKB5xjk2IIX8V39tp-1W03r3Vq96c7Ubr_fk1AWA,6919
361
- invenio_app_ils/series/mappings/os-v2/series/series-v2.0.0.json,sha256=_adu2g4XAy_lzfSpBfBMxcZDnnUG1NUXcHORI2VvVoo,7801
361
+ invenio_app_ils/series/mappings/os-v2/series/series-v2.0.0.json,sha256=OzuSTg1RkGk2ulRyl2aeAIpZrTnb5AQedMPYih5o8Q0,9082
362
362
  invenio_app_ils/series/mappings/v7/__init__.py,sha256=1Fny1TaeM8uc9Rwvw2bf94RvxEY067R5nP5Lz17UEGs,239
363
363
  invenio_app_ils/series/mappings/v7/series/series-v1.0.0.json,sha256=YJLsKB5xjk2IIX8V39tp-1W03r3Vq96c7Ubr_fk1AWA,6919
364
- invenio_app_ils/series/mappings/v7/series/series-v2.0.0.json,sha256=_adu2g4XAy_lzfSpBfBMxcZDnnUG1NUXcHORI2VvVoo,7801
364
+ invenio_app_ils/series/mappings/v7/series/series-v2.0.0.json,sha256=OzuSTg1RkGk2ulRyl2aeAIpZrTnb5AQedMPYih5o8Q0,9082
365
365
  invenio_app_ils/series/schemas/__init__.py,sha256=eDOGPLGzu3SSD7UyY3kx3XnZNpnBS91-7uktXhJnoYI,232
366
366
  invenio_app_ils/series/schemas/series/series-v1.0.0.json,sha256=QrNqmAeuqZysIHVB4czPKmsmZM7zlbECaub3fEOlvGM,8413
367
367
  invenio_app_ils/series/schemas/series/series-v2.0.0.json,sha256=QrNqmAeuqZysIHVB4czPKmsmZM7zlbECaub3fEOlvGM,8413
@@ -500,9 +500,8 @@ tests/api/ils/eitems/test_eitems_permissions.py,sha256=__AlVOpr6Q36xOIiISGTFqAJT
500
500
  tests/api/ils/eitems/test_files.py,sha256=KnzvSYo1HqnFCexXkcKZmmvr_9e4fcABc2D-dE5blK8,4625
501
501
  tests/api/ils/items/__init__.py,sha256=oc7OKnwhkZsi7f8mMAoWhwBFQTHVYeDSAWFVLBXQuEs,229
502
502
  tests/api/ils/items/test_apis.py,sha256=hLD8RCEkGYld7af_JwDFAIL69x8Rin_kElLpqjDn-KE,1366
503
- tests/api/ils/items/test_items_crud.py,sha256=IS1o8Lm3dNKOmt2mrp2bzkTn8KVyTK_WCWEf5ikoCIU,1794
503
+ tests/api/ils/items/test_items_crud.py,sha256=HB3vV5PZWTA1ugumVh7ej9RobRhX1Xf6qIfVRLred7k,3221
504
504
  tests/api/ils/items/test_items_permissions.py,sha256=HE-yYAc6_fza_JXpvTzjcjA9341iAKevJKBoh99jbbw,3757
505
- tests/api/ils/items/test_items_update.py,sha256=_ZZTeh1Y1SZ6zN34O-rVTpEMDyUwqh2LBzbHXsgo69M,1417
506
505
  tests/api/ils/records_relations/__init__.py,sha256=VxNqRmCl2IBDm6PFgG_q_CfFMwFKojB9QtiB-LBONfo,241
507
506
  tests/api/ils/records_relations/helpers.py,sha256=lm2dQdACxYuU2ro-ymA0OtqiKYYldwax8kRmYiqxuWM,3875
508
507
  tests/api/ils/records_relations/test_records_relations_parentchild.py,sha256=vY5gr8L0nrdlvbGKM_wYSD6Vtp4L0QiZoP3YIlwxisA,17969
@@ -528,10 +527,10 @@ tests/templates/notifications/title_body.html,sha256=W-pa6eSm7glK9JEcTVo4G7yC3Q1
528
527
  tests/templates/notifications/title_body_html.html,sha256=wPDP-DpQ0c2AX3oIfLvJLRp7J_rMoesIc9nLx3apkDc,146
529
528
  tests/templates/notifications/title_body_html_ctx.html,sha256=qqfTZ9zKVXFqyXIcqt5BLHEJptRlUDPBPtLxPfTmNzQ,193
530
529
  tests/templates/notifications/title_only.html,sha256=aoZ0veSleRYdKPXWgN6fdXLaz3r-KAPzdfHSuHPR2Uo,45
531
- invenio_app_ils-4.0.0rc1.dist-info/AUTHORS.rst,sha256=BaXCGzdHCmiMOl4qtVlh1qrfy2ROMVOQp6ylzy1m0ww,212
532
- invenio_app_ils-4.0.0rc1.dist-info/LICENSE,sha256=9OdaPOAO1ZOJcRQ8BrGj7QAdaJc8SRSUgBtdom49MrI,1062
533
- invenio_app_ils-4.0.0rc1.dist-info/METADATA,sha256=TIUbpo8z4Sbsiap_kuYSXy-yUHD47vnoIS8LlEXL2Nw,15792
534
- invenio_app_ils-4.0.0rc1.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
535
- invenio_app_ils-4.0.0rc1.dist-info/entry_points.txt,sha256=JbIlm87pY7dVL-gLh8Hmfav18psVHXLBmHBzA-fQqlY,7607
536
- invenio_app_ils-4.0.0rc1.dist-info/top_level.txt,sha256=MQTU2NrM0if5YAyIsKmQ0k35skJ3IUyQT7eCD2IWiNQ,22
537
- invenio_app_ils-4.0.0rc1.dist-info/RECORD,,
530
+ invenio_app_ils-4.2.0.dist-info/AUTHORS.rst,sha256=BaXCGzdHCmiMOl4qtVlh1qrfy2ROMVOQp6ylzy1m0ww,212
531
+ invenio_app_ils-4.2.0.dist-info/LICENSE,sha256=9OdaPOAO1ZOJcRQ8BrGj7QAdaJc8SRSUgBtdom49MrI,1062
532
+ invenio_app_ils-4.2.0.dist-info/METADATA,sha256=Y_QgDlw4LmdUhMgdoFh7WwQ34zlpruRFEn1mN9JnSQo,15976
533
+ invenio_app_ils-4.2.0.dist-info/WHEEL,sha256=fS9sRbCBHs7VFcwJLnLXN1MZRR0_TVTxvXKzOnaSFs8,110
534
+ invenio_app_ils-4.2.0.dist-info/entry_points.txt,sha256=JbIlm87pY7dVL-gLh8Hmfav18psVHXLBmHBzA-fQqlY,7607
535
+ invenio_app_ils-4.2.0.dist-info/top_level.txt,sha256=MQTU2NrM0if5YAyIsKmQ0k35skJ3IUyQT7eCD2IWiNQ,22
536
+ invenio_app_ils-4.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.44.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -11,11 +11,16 @@ from copy import deepcopy
11
11
 
12
12
  import pytest
13
13
 
14
- from invenio_app_ils.errors import DocumentNotFoundError, InternalLocationNotFoundError
15
- from invenio_app_ils.items.api import Item
14
+ from invenio_app_ils.circulation.search import get_active_loan_by_item_pid
15
+ from invenio_app_ils.errors import (
16
+ DocumentNotFoundError,
17
+ InternalLocationNotFoundError,
18
+ ItemHasPastLoansError,
19
+ )
20
+ from invenio_app_ils.items.api import ITEM_PID_TYPE, Item
16
21
 
17
22
 
18
- def test_item_refs(app, testdata):
23
+ def test_item_create(app, testdata):
19
24
  """Test creation of an item."""
20
25
  item = Item.create(
21
26
  dict(
@@ -23,7 +28,7 @@ def test_item_refs(app, testdata):
23
28
  document_pid="docid-1",
24
29
  internal_location_pid="ilocid-4",
25
30
  created_by=dict(type="script", value="demo"),
26
- barcode="348048",
31
+ barcode="cm-348048",
27
32
  status="CAN_CIRCULATE",
28
33
  circulation_restriction="NO_RESTRICTION",
29
34
  medium="PAPER",
@@ -31,6 +36,7 @@ def test_item_refs(app, testdata):
31
36
  )
32
37
  assert "$schema" in item
33
38
  assert "document" in item and "$ref" in item["document"]
39
+ assert item["barcode"] == "CM-348048"
34
40
  assert "internal_location" in item and "$ref" in item["internal_location"]
35
41
 
36
42
  item = Item.get_record_by_pid("itemid-1")
@@ -39,6 +45,16 @@ def test_item_refs(app, testdata):
39
45
  assert "internal_location" in item and item["internal_location"]["name"]
40
46
 
41
47
 
48
+ def test_item_update(app, db, testdata):
49
+ """Test update of an item."""
50
+ item = Item.get_record_by_pid("itemid-1")
51
+ item.update(dict(barcode="cm-348048"))
52
+ item.commit()
53
+ db.session.commit()
54
+
55
+ assert Item.get_record_by_pid("itemid-1")["barcode"] == "CM-348048"
56
+
57
+
42
58
  def test_item_validation(db, testdata):
43
59
  """Test validation when updating an item."""
44
60
  item_pid = testdata["items"][0]["pid"]
@@ -55,3 +71,29 @@ def test_item_validation(db, testdata):
55
71
  item["internal_location_pid"] = "not_found_pid"
56
72
  with pytest.raises(InternalLocationNotFoundError):
57
73
  item.commit()
74
+
75
+
76
+ def test_item_references(db, testdata):
77
+ """Test references when updating an item."""
78
+
79
+ def get_active_loan_pid_and_item_pid():
80
+ for t in testdata["items"]:
81
+ if t["status"] == "CAN_CIRCULATE":
82
+ item_pid = dict(type=ITEM_PID_TYPE, value=t["pid"])
83
+ active_loan = get_active_loan_by_item_pid(item_pid).execute().hits
84
+ total = active_loan.total.value
85
+ if total > 0:
86
+ return t["pid"], active_loan[0]["pid"]
87
+
88
+ # change document pid while is on loan
89
+ item_pid, loan_pid = get_active_loan_pid_and_item_pid()
90
+ item = Item.get_record_by_pid(item_pid)
91
+ item["document_pid"] = "docid-1"
92
+ with pytest.raises(ItemHasPastLoansError):
93
+ item.commit()
94
+
95
+ # change document to one that does not exist
96
+ item = Item.get_record_by_pid("itemid-1")
97
+ item["document_pid"] = "not_found_doc"
98
+ with pytest.raises(DocumentNotFoundError):
99
+ item.commit()
@@ -1,40 +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
- """Test record delete."""
9
-
10
- import pytest
11
-
12
- from invenio_app_ils.circulation.search import get_active_loan_by_item_pid
13
- from invenio_app_ils.errors import DocumentNotFoundError, ItemHasPastLoansError
14
- from invenio_app_ils.items.api import ITEM_PID_TYPE, Item
15
-
16
-
17
- def test_update_item(db, testdata):
18
- """Test update item status."""
19
-
20
- def get_active_loan_pid_and_item_pid():
21
- for t in testdata["items"]:
22
- if t["status"] == "CAN_CIRCULATE":
23
- item_pid = dict(type=ITEM_PID_TYPE, value=t["pid"])
24
- active_loan = get_active_loan_by_item_pid(item_pid).execute().hits
25
- total = active_loan.total.value
26
- if total > 0:
27
- return t["pid"], active_loan[0]["pid"]
28
-
29
- # change document pid while is on loan
30
- item_pid, loan_pid = get_active_loan_pid_and_item_pid()
31
- item = Item.get_record_by_pid(item_pid)
32
- item["document_pid"] = "docid-1"
33
- with pytest.raises(ItemHasPastLoansError):
34
- item.commit()
35
-
36
- # change document to one that does not exist
37
- item = Item.get_record_by_pid("itemid-1")
38
- item["document_pid"] = "not_found_doc"
39
- with pytest.raises(DocumentNotFoundError):
40
- item.commit()