invenio-app-ils 1.0.0a54__py2.py3-none-any.whl → 6.1.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 (331) hide show
  1. invenio_app_ils/__init__.py +2 -2
  2. invenio_app_ils/acquisition/api.py +3 -1
  3. invenio_app_ils/acquisition/config.py +10 -21
  4. invenio_app_ils/acquisition/jsonresolvers/order_order_lines.py +1 -0
  5. invenio_app_ils/acquisition/mappings/os-v1/acq_orders/order-v1.0.0.json +364 -0
  6. invenio_app_ils/acquisition/mappings/os-v2/__init__.py +0 -0
  7. invenio_app_ils/acquisition/mappings/os-v2/acq_orders/order-v1.0.0.json +364 -0
  8. invenio_app_ils/acquisition/mappings/v7/acq_orders/order-v1.0.0.json +14 -0
  9. invenio_app_ils/acquisition/search.py +5 -15
  10. invenio_app_ils/assets/semantic-ui/less/theme.config +103 -0
  11. invenio_app_ils/assets/semantic-ui/templates/.gitkeep +0 -0
  12. invenio_app_ils/circulation/api.py +153 -67
  13. invenio_app_ils/circulation/config.py +29 -25
  14. invenio_app_ils/circulation/indexer.py +14 -19
  15. invenio_app_ils/circulation/loaders/__init__.py +2 -0
  16. invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py +2 -3
  17. invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +82 -16
  18. invenio_app_ils/circulation/loaders/schemas/json/loan_self_checkout.py +19 -0
  19. invenio_app_ils/circulation/notifications/api.py +23 -19
  20. invenio_app_ils/circulation/notifications/messages.py +6 -6
  21. invenio_app_ils/circulation/notifications/tasks.py +1 -2
  22. invenio_app_ils/circulation/receivers.py +2 -5
  23. invenio_app_ils/circulation/search.py +23 -22
  24. invenio_app_ils/circulation/serializers/__init__.py +2 -2
  25. invenio_app_ils/circulation/serializers/csv.py +1 -3
  26. invenio_app_ils/circulation/serializers/custom_fields.py +5 -9
  27. invenio_app_ils/circulation/serializers/json.py +2 -6
  28. invenio_app_ils/circulation/serializers/response.py +12 -12
  29. invenio_app_ils/circulation/stats/views.py +5 -15
  30. invenio_app_ils/circulation/tasks.py +2 -6
  31. invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/self_checkout.html +19 -0
  32. invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/update_dates.html +19 -0
  33. invenio_app_ils/circulation/utils.py +23 -17
  34. invenio_app_ils/circulation/views.py +103 -39
  35. invenio_app_ils/cli.py +220 -260
  36. invenio_app_ils/closures/api.py +72 -7
  37. invenio_app_ils/closures/serializers/__init__.py +16 -0
  38. invenio_app_ils/closures/serializers/response.py +35 -0
  39. invenio_app_ils/closures/serializers/schema.py +28 -0
  40. invenio_app_ils/closures/tasks.py +4 -11
  41. invenio_app_ils/closures/views.py +66 -0
  42. invenio_app_ils/config.py +207 -150
  43. invenio_app_ils/document_requests/api.py +6 -21
  44. invenio_app_ils/document_requests/loaders/__init__.py +4 -12
  45. invenio_app_ils/document_requests/mappings/{v6 → os-v1}/__init__.py +2 -2
  46. invenio_app_ils/document_requests/mappings/os-v1/document_requests/document_request-v1.0.0.json +196 -0
  47. invenio_app_ils/document_requests/mappings/os-v2/__init__.py +8 -0
  48. invenio_app_ils/document_requests/mappings/os-v2/document_requests/document_request-v1.0.0.json +196 -0
  49. invenio_app_ils/document_requests/notifications/api.py +2 -7
  50. invenio_app_ils/document_requests/notifications/messages.py +3 -7
  51. invenio_app_ils/document_requests/search.py +2 -6
  52. invenio_app_ils/document_requests/views.py +4 -10
  53. invenio_app_ils/documents/api.py +19 -25
  54. invenio_app_ils/documents/indexer.py +13 -20
  55. invenio_app_ils/documents/jsonresolvers/document_circulation.py +11 -33
  56. invenio_app_ils/documents/jsonresolvers/document_eitem.py +1 -0
  57. invenio_app_ils/documents/jsonresolvers/document_item.py +8 -9
  58. invenio_app_ils/documents/jsonresolvers/document_stock.py +7 -7
  59. invenio_app_ils/documents/loaders/jsonschemas/document.py +3 -14
  60. invenio_app_ils/documents/mappings/{v6 → os-v1}/__init__.py +1 -1
  61. invenio_app_ils/documents/mappings/os-v1/documents/document-v1.0.0.json +932 -0
  62. invenio_app_ils/documents/mappings/os-v1/documents/document-v2.0.0.json +1066 -0
  63. invenio_app_ils/documents/mappings/os-v2/__init__.py +8 -0
  64. invenio_app_ils/documents/mappings/os-v2/documents/document-v1.0.0.json +932 -0
  65. invenio_app_ils/documents/mappings/os-v2/documents/document-v2.0.0.json +1066 -0
  66. invenio_app_ils/documents/mappings/v7/documents/document-v1.0.0.json +102 -11
  67. invenio_app_ils/documents/mappings/v7/documents/document-v2.0.0.json +1066 -0
  68. invenio_app_ils/documents/schemas/documents/document-v2.0.0.json +732 -0
  69. invenio_app_ils/eitems/api.py +41 -7
  70. invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +6 -6
  71. invenio_app_ils/eitems/mappings/{v6 → os-v1}/__init__.py +1 -1
  72. invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v1.0.0.json +139 -0
  73. invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v2.0.0.json +142 -0
  74. invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v3.0.0.json +179 -0
  75. invenio_app_ils/{series/mappings/v6 → eitems/mappings/os-v2}/__init__.py +1 -1
  76. invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v1.0.0.json +139 -0
  77. invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v2.0.0.json +142 -0
  78. invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v3.0.0.json +179 -0
  79. invenio_app_ils/eitems/mappings/v7/eitems/eitem-v1.0.0.json +12 -2
  80. invenio_app_ils/eitems/mappings/v7/eitems/eitem-v2.0.0.json +142 -0
  81. invenio_app_ils/eitems/mappings/v7/eitems/eitem-v3.0.0.json +179 -0
  82. invenio_app_ils/eitems/schemas/eitems/eitem-v2.0.0.json +120 -0
  83. invenio_app_ils/eitems/schemas/eitems/eitem-v3.0.0.json +120 -0
  84. invenio_app_ils/eitems/search.py +3 -9
  85. invenio_app_ils/errors.py +119 -6
  86. invenio_app_ils/ext.py +15 -18
  87. invenio_app_ils/facets.py +13 -15
  88. invenio_app_ils/files/receivers.py +1 -1
  89. invenio_app_ils/files/views.py +1 -2
  90. invenio_app_ils/ill/api.py +1 -2
  91. invenio_app_ils/ill/config.py +10 -16
  92. invenio_app_ils/ill/jsonresolvers/borrowing_request_document.py +2 -3
  93. invenio_app_ils/ill/jsonresolvers/borrowing_request_patron.py +1 -3
  94. invenio_app_ils/ill/jsonresolvers/borrowing_request_provider.py +1 -3
  95. invenio_app_ils/ill/loaders/__init__.py +3 -9
  96. invenio_app_ils/ill/loaders/jsonschemas/patron_loan_actions.py +1 -8
  97. invenio_app_ils/ill/loaders/jsonschemas/patron_loan_extension_actions.py +3 -8
  98. invenio_app_ils/ill/mappings/{v6 → os-v1}/__init__.py +1 -1
  99. invenio_app_ils/ill/mappings/os-v1/ill_borrowing_requests/borrowing_request-v1.0.0.json +254 -0
  100. invenio_app_ils/{acquisition/mappings/v6 → ill/mappings/os-v2}/__init__.py +1 -1
  101. invenio_app_ils/ill/mappings/os-v2/ill_borrowing_requests/borrowing_request-v1.0.0.json +254 -0
  102. invenio_app_ils/ill/mappings/v7/ill_borrowing_requests/borrowing_request-v1.0.0.json +14 -0
  103. invenio_app_ils/ill/notifications/api.py +1 -4
  104. invenio_app_ils/ill/search.py +3 -9
  105. invenio_app_ils/ill/serializers/__init__.py +1 -3
  106. invenio_app_ils/ill/views.py +2 -4
  107. invenio_app_ils/internal_locations/api.py +1 -4
  108. invenio_app_ils/internal_locations/mappings/{v6 → os-v1}/__init__.py +1 -1
  109. invenio_app_ils/internal_locations/mappings/os-v1/internal_locations/internal_location-v1.0.0.json +108 -0
  110. invenio_app_ils/internal_locations/mappings/os-v2/__init__.py +8 -0
  111. invenio_app_ils/internal_locations/mappings/os-v2/internal_locations/internal_location-v1.0.0.json +108 -0
  112. invenio_app_ils/internal_locations/search.py +1 -3
  113. invenio_app_ils/items/api.py +18 -15
  114. invenio_app_ils/items/indexer.py +1 -3
  115. invenio_app_ils/items/jsonresolvers/item_document.py +1 -1
  116. invenio_app_ils/items/jsonresolvers/item_internal_location.py +2 -6
  117. invenio_app_ils/items/loaders/jsonschemas/items.py +2 -0
  118. {tests/api/circulation → invenio_app_ils/items/mappings/os-v1}/__init__.py +1 -1
  119. invenio_app_ils/items/mappings/os-v1/items/item-v1.0.0.json +285 -0
  120. invenio_app_ils/items/mappings/os-v1/items/item-v2.0.0.json +326 -0
  121. {tests/api/ill → invenio_app_ils/items/mappings/os-v2}/__init__.py +1 -1
  122. invenio_app_ils/items/mappings/os-v2/items/item-v1.0.0.json +285 -0
  123. invenio_app_ils/items/mappings/os-v2/items/item-v2.0.0.json +326 -0
  124. invenio_app_ils/items/mappings/v7/items/item-v1.0.0.json +11 -0
  125. invenio_app_ils/items/mappings/v7/items/item-v2.0.0.json +326 -0
  126. invenio_app_ils/items/schemas/items/item-v1.0.0.json +22 -0
  127. invenio_app_ils/items/schemas/items/item-v2.0.0.json +172 -0
  128. invenio_app_ils/items/search.py +18 -11
  129. invenio_app_ils/items/serializers/item.py +7 -6
  130. invenio_app_ils/literature/api.py +1 -3
  131. invenio_app_ils/literature/search.py +3 -5
  132. invenio_app_ils/literature/serializers/csv.py +1 -3
  133. invenio_app_ils/literature/serializers/json.py +1 -3
  134. invenio_app_ils/locations/api.py +2 -4
  135. invenio_app_ils/locations/indexer.py +3 -9
  136. invenio_app_ils/locations/loaders/__init__.py +1 -3
  137. invenio_app_ils/locations/loaders/jsonschemas/location.py +4 -11
  138. invenio_app_ils/locations/mappings/{v6 → os-v1}/__init__.py +1 -1
  139. invenio_app_ils/locations/mappings/os-v1/locations/location-v1.0.0.json +90 -0
  140. invenio_app_ils/locations/mappings/os-v2/__init__.py +8 -0
  141. invenio_app_ils/locations/mappings/os-v2/locations/location-v1.0.0.json +90 -0
  142. invenio_app_ils/notifications/messages.py +4 -3
  143. invenio_app_ils/notifications/tasks.py +1 -3
  144. invenio_app_ils/notifications/views.py +2 -2
  145. invenio_app_ils/patrons/anonymization.py +53 -32
  146. invenio_app_ils/patrons/api.py +3 -5
  147. invenio_app_ils/patrons/cli.py +1 -2
  148. invenio_app_ils/patrons/indexer.py +4 -13
  149. invenio_app_ils/patrons/mappings/os-v1/__init__.py +8 -0
  150. invenio_app_ils/patrons/mappings/os-v1/patrons/patron-v1.0.0.json +42 -0
  151. invenio_app_ils/patrons/mappings/os-v2/__init__.py +8 -0
  152. invenio_app_ils/patrons/mappings/os-v2/patrons/patron-v1.0.0.json +42 -0
  153. invenio_app_ils/patrons/views.py +4 -14
  154. invenio_app_ils/permissions.py +93 -35
  155. invenio_app_ils/providers/api.py +2 -6
  156. invenio_app_ils/providers/config.py +11 -19
  157. invenio_app_ils/providers/indexer.py +2 -6
  158. invenio_app_ils/providers/mappings/{v6 → os-v1}/__init__.py +1 -1
  159. invenio_app_ils/providers/mappings/os-v1/providers/provider-v1.0.0.json +57 -0
  160. invenio_app_ils/providers/mappings/os-v2/__init__.py +8 -0
  161. invenio_app_ils/providers/mappings/os-v2/providers/provider-v1.0.0.json +57 -0
  162. invenio_app_ils/providers/mappings/v7/__init__.py +1 -1
  163. invenio_app_ils/providers/proxies.py +1 -3
  164. invenio_app_ils/records/api.py +3 -9
  165. invenio_app_ils/records/loaders/schemas/changed_by.py +1 -3
  166. invenio_app_ils/records/loaders/schemas/identifiers.py +23 -0
  167. invenio_app_ils/records/metadata_extensions.py +1 -4
  168. invenio_app_ils/records/permissions.py +8 -2
  169. invenio_app_ils/records/serializers/__init__.py +1 -4
  170. invenio_app_ils/records/views.py +4 -7
  171. invenio_app_ils/records_relations/api.py +11 -34
  172. invenio_app_ils/records_relations/indexer.py +1 -3
  173. invenio_app_ils/records_relations/retriever.py +14 -9
  174. invenio_app_ils/records_relations/views.py +16 -50
  175. invenio_app_ils/relations/api.py +17 -16
  176. invenio_app_ils/search_permissions.py +24 -24
  177. invenio_app_ils/series/api.py +10 -12
  178. invenio_app_ils/series/loaders/jsonschemas/series.py +3 -2
  179. invenio_app_ils/{items/mappings/v6 → series/mappings/os-v1}/__init__.py +1 -1
  180. invenio_app_ils/series/mappings/os-v1/series/series-v1.0.0.json +324 -0
  181. invenio_app_ils/series/mappings/os-v1/series/series-v2.0.0.json +396 -0
  182. {tests/api/acquisition → invenio_app_ils/series/mappings/os-v2}/__init__.py +1 -1
  183. invenio_app_ils/series/mappings/os-v2/series/series-v1.0.0.json +324 -0
  184. invenio_app_ils/series/mappings/os-v2/series/series-v2.0.0.json +396 -0
  185. invenio_app_ils/series/mappings/v7/series/series-v1.0.0.json +35 -3
  186. invenio_app_ils/series/mappings/v7/series/series-v2.0.0.json +396 -0
  187. invenio_app_ils/series/schemas/series/series-v2.0.0.json +354 -0
  188. invenio_app_ils/stats/aggregations/aggr_file_download/os-v1/aggr-file-download-v1.json +60 -0
  189. invenio_app_ils/stats/aggregations/aggr_file_download/os-v2/__init__.py +9 -0
  190. invenio_app_ils/stats/aggregations/aggr_file_download/os-v2/aggr-file-download-v1.json +60 -0
  191. invenio_app_ils/stats/event_builders.py +73 -0
  192. invenio_app_ils/stats/file_download/os-v1/file-download-v1.json +72 -0
  193. invenio_app_ils/stats/file_download/os-v2/__init__.py +9 -0
  194. invenio_app_ils/stats/file_download/os-v2/file-download-v1.json +72 -0
  195. invenio_app_ils/stats/processors.py +30 -0
  196. invenio_app_ils/stats/templates/aggregations/__init__.py +8 -0
  197. invenio_app_ils/stats/templates/aggregations/ils_record_changes/__init__.py +8 -0
  198. invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/__init__.py +8 -0
  199. invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/aggr-ils-record-changes-v1.json +41 -0
  200. {tests → invenio_app_ils/stats/templates/events}/__init__.py +2 -2
  201. invenio_app_ils/stats/templates/events/ils_record_changes/__init__.py +8 -0
  202. invenio_app_ils/stats/templates/events/ils_record_changes/os-v2/__init__.py +8 -0
  203. invenio_app_ils/stats/templates/events/ils_record_changes/os-v2/ils-record-changes-v1.json +41 -0
  204. invenio_app_ils/templates/logged_out.html +12 -0
  205. invenio_app_ils/views.py +18 -4
  206. invenio_app_ils/vocabularies/api.py +1 -1
  207. invenio_app_ils/vocabularies/cli.py +6 -18
  208. invenio_app_ils/vocabularies/data/acq_order_line_payment_modes.json +5 -0
  209. invenio_app_ils/vocabularies/data/identifier_schemes.json +5 -0
  210. invenio_app_ils/vocabularies/indexer.py +1 -4
  211. invenio_app_ils/vocabularies/jsonresolvers/licenses.py +2 -11
  212. invenio_app_ils/vocabularies/mappings/os-v1/__init__.py +8 -0
  213. invenio_app_ils/vocabularies/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +23 -0
  214. invenio_app_ils/vocabularies/mappings/os-v2/__init__.py +8 -0
  215. invenio_app_ils/vocabularies/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +23 -0
  216. invenio_app_ils/vocabularies/sources/base.py +1 -3
  217. invenio_app_ils/webpack.py +27 -0
  218. invenio_app_ils-6.1.0.dist-info/METADATA +627 -0
  219. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/RECORD +227 -249
  220. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/WHEEL +1 -1
  221. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/entry_points.txt +9 -5
  222. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/top_level.txt +0 -1
  223. invenio_app_ils/acquisition/mappings/v6/acq_orders/order-v1.0.0.json +0 -352
  224. invenio_app_ils/document_requests/mappings/v6/document_requests/document_request-v1.0.0.json +0 -199
  225. invenio_app_ils/documents/mappings/v6/documents/document-v1.0.0.json +0 -843
  226. invenio_app_ils/eitems/mappings/v6/eitems/eitem-v1.0.0.json +0 -131
  227. invenio_app_ils/ill/mappings/v6/ill_borrowing_requests/borrowing_request-v1.0.0.json +0 -242
  228. invenio_app_ils/internal_locations/mappings/v6/internal_locations/internal_location-v1.0.0.json +0 -110
  229. invenio_app_ils/items/mappings/v6/items/item-v1.0.0.json +0 -276
  230. invenio_app_ils/locations/mappings/v6/locations/location-v1.0.0.json +0 -92
  231. invenio_app_ils/notifications/admin.py +0 -57
  232. invenio_app_ils/patrons/mappings/v6/__init__.py +0 -8
  233. invenio_app_ils/patrons/mappings/v6/patrons/patron-v1.0.0.json +0 -44
  234. invenio_app_ils/providers/mappings/v6/providers/provider-v1.0.0.json +0 -59
  235. invenio_app_ils/series/mappings/v6/series/series-v1.0.0.json +0 -298
  236. invenio_app_ils/stats/aggregations/aggr_file_download/v6/aggr-file-download-v1.json +0 -59
  237. invenio_app_ils/stats/file_download/v6/file-download-v1.json +0 -74
  238. invenio_app_ils/version.py +0 -14
  239. invenio_app_ils/vocabularies/mappings/v6/__init__.py +0 -8
  240. invenio_app_ils/vocabularies/mappings/v6/vocabularies/vocabulary-v1.0.0.json +0 -25
  241. invenio_app_ils-1.0.0a54.dist-info/METADATA +0 -95
  242. tests/api/__init__.py +0 -8
  243. tests/api/acquisition/test_acq_orders_crud.py +0 -102
  244. tests/api/acquisition/test_acq_orders_permissions.py +0 -104
  245. tests/api/acquisition/test_acq_providers_permissions.py +0 -83
  246. tests/api/circulation/test_expired_loans.py +0 -88
  247. tests/api/circulation/test_loan_checkout.py +0 -216
  248. tests/api/circulation/test_loan_default_durations.py +0 -57
  249. tests/api/circulation/test_loan_document_resolver.py +0 -18
  250. tests/api/circulation/test_loan_extend.py +0 -132
  251. tests/api/circulation/test_loan_item_permissions.py +0 -139
  252. tests/api/circulation/test_loan_item_resolver.py +0 -26
  253. tests/api/circulation/test_loan_list_permissions.py +0 -104
  254. tests/api/circulation/test_loan_patron_resolver.py +0 -38
  255. tests/api/circulation/test_loan_request.py +0 -234
  256. tests/api/circulation/test_loan_update.py +0 -150
  257. tests/api/circulation/test_notifications.py +0 -229
  258. tests/api/conftest.py +0 -236
  259. tests/api/document_requests/__init__.py +0 -8
  260. tests/api/document_requests/test_document_requests.py +0 -131
  261. tests/api/document_requests/test_document_requests_permissions.py +0 -177
  262. tests/api/document_requests/test_notifications_filter.py +0 -36
  263. tests/api/ill/test_ill_brw_crud.py +0 -84
  264. tests/api/ill/test_ill_brw_reqs_patron_loan_create_action.py +0 -207
  265. tests/api/ill/test_ill_brw_reqs_patron_loan_extension_actions.py +0 -298
  266. tests/api/ill/test_ill_brw_reqs_permissions.py +0 -169
  267. tests/api/ill/test_ill_providers_permissions.py +0 -82
  268. tests/api/ils/__init__.py +0 -8
  269. tests/api/ils/documents/__init__.py +0 -8
  270. tests/api/ils/documents/test_document_crud.py +0 -57
  271. tests/api/ils/documents/test_document_permissions.py +0 -106
  272. tests/api/ils/documents/test_document_resolvers.py +0 -35
  273. tests/api/ils/eitems/__init__.py +0 -8
  274. tests/api/ils/eitems/test_eitems_crud.py +0 -41
  275. tests/api/ils/eitems/test_eitems_permissions.py +0 -84
  276. tests/api/ils/eitems/test_files.py +0 -172
  277. tests/api/ils/items/__init__.py +0 -8
  278. tests/api/ils/items/test_apis.py +0 -43
  279. tests/api/ils/items/test_items_crud.py +0 -60
  280. tests/api/ils/items/test_items_permissions.py +0 -107
  281. tests/api/ils/items/test_items_update.py +0 -47
  282. tests/api/ils/records_relations/__init__.py +0 -8
  283. tests/api/ils/records_relations/helpers.py +0 -115
  284. tests/api/ils/records_relations/test_records_relations_parentchild.py +0 -560
  285. tests/api/ils/records_relations/test_records_relations_sequence.py +0 -302
  286. tests/api/ils/records_relations/test_records_relations_siblings.py +0 -678
  287. tests/api/ils/series/__init__.py +0 -8
  288. tests/api/ils/series/test_series_permissions.py +0 -95
  289. tests/api/ils/test_anonymization.py +0 -189
  290. tests/api/ils/test_apis.py +0 -76
  291. tests/api/ils/test_closures.py +0 -324
  292. tests/api/ils/test_errors.py +0 -126
  293. tests/api/ils/test_facets.py +0 -84
  294. tests/api/ils/test_internal_locations.py +0 -96
  295. tests/api/ils/test_loaders.py +0 -55
  296. tests/api/ils/test_metadata_extensions.py +0 -205
  297. tests/api/ils/test_notifications.py +0 -183
  298. tests/api/ils/test_notifications_mails.py +0 -39
  299. tests/api/ils/test_notifications_permissions.py +0 -55
  300. tests/api/ils/test_patrons.py +0 -106
  301. tests/api/ils/test_record_delete.py +0 -46
  302. tests/api/ils/test_record_permissions.py +0 -135
  303. tests/api/ils/test_resolvers.py +0 -207
  304. tests/api/ils/test_stats.py +0 -160
  305. tests/api/ils/test_tasks.py +0 -211
  306. tests/api/ils/test_vocabularies.py +0 -35
  307. tests/conftest.py +0 -123
  308. tests/data/acq_orders.json +0 -89
  309. tests/data/acq_providers.json +0 -12
  310. tests/data/document_requests.json +0 -77
  311. tests/data/documents.json +0 -237
  312. tests/data/eitems.json +0 -66
  313. tests/data/ill_borrowing_requests.json +0 -77
  314. tests/data/ill_providers.json +0 -12
  315. tests/data/internal_locations.json +0 -22
  316. tests/data/items.json +0 -271
  317. tests/data/loans.json +0 -133
  318. tests/data/loans_most_loaned.json +0 -128
  319. tests/data/locations.json +0 -20
  320. tests/data/series.json +0 -33
  321. tests/helpers.py +0 -104
  322. tests/templates/notifications/title_body.html +0 -8
  323. tests/templates/notifications/title_body_html.html +0 -13
  324. tests/templates/notifications/title_body_html_ctx.html +0 -13
  325. tests/templates/notifications/title_only.html +0 -3
  326. tests/test_version.py +0 -17
  327. /tests/templates/notifications/blank.html → /invenio_app_ils/acquisition/mappings/os-v1/__init__.py +0 -0
  328. /invenio_app_ils/stats/aggregations/aggr_file_download/{v6 → os-v1}/__init__.py +0 -0
  329. /invenio_app_ils/stats/file_download/{v6 → os-v1}/__init__.py +0 -0
  330. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info/licenses}/AUTHORS.rst +0 -0
  331. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info/licenses}/LICENSE +0 -0
@@ -1,207 +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 Items resolvers."""
9
-
10
- from invenio_circulation.pidstore.pids import CIRCULATION_LOAN_PID_TYPE
11
-
12
- from invenio_app_ils.acquisition.api import ORDER_PID_TYPE
13
- from invenio_app_ils.document_requests.api import DOCUMENT_REQUEST_PID_TYPE
14
- from invenio_app_ils.documents.api import DOCUMENT_PID_TYPE, Document
15
- from invenio_app_ils.documents.indexer import DocumentIndexer
16
- from invenio_app_ils.eitems.api import EITEM_PID_TYPE, EItem
17
- from invenio_app_ils.eitems.indexer import EItemIndexer
18
- from invenio_app_ils.ill.api import BORROWING_REQUEST_PID_TYPE
19
- from invenio_app_ils.internal_locations.indexer import InternalLocationIndexer
20
- from invenio_app_ils.items.api import ITEM_PID_TYPE, Item
21
- from invenio_app_ils.items.indexer import ItemIndexer
22
- from invenio_app_ils.locations.api import LOCATION_PID_TYPE, Location
23
- from invenio_app_ils.locations.indexer import LocationIndexer
24
- from invenio_app_ils.patrons.api import PATRON_PID_TYPE, Patron
25
- from invenio_app_ils.patrons.indexer import PatronIndexer
26
-
27
- from invenio_app_ils.internal_locations.api import ( # isort:skip
28
- INTERNAL_LOCATION_PID_TYPE,
29
- InternalLocation,
30
- )
31
-
32
-
33
- def test_jsonresolvers(testdata, mocker):
34
- """Test that all records referencing a changed record are re-indexed."""
35
-
36
- def _get_mock():
37
- return mocker.patch(
38
- "invenio_app_ils.indexer.ReferencedRecordsIndexer.index"
39
- )
40
-
41
- def _assert_origin(indexer, pid_type, pid_value):
42
- """Assert that origin is called and return all referenced."""
43
- assert indexer.called
44
- all_calls = indexer.call_args_list
45
- first_call = all_calls[0]
46
- indexed, referenced = first_call[0]
47
- assert indexed["pid_type"] == pid_type
48
- assert indexed["record"]["pid"] == pid_value
49
-
50
- # call[0] is the list of arguments passed to the function
51
- # call[0][0] is the origin record, call[0][1] is the referenced record
52
- all_referenced = []
53
- for call in all_calls:
54
- origin, referenced = call[0]
55
- all_referenced += referenced
56
- return all_referenced
57
-
58
- def _assert_contains(referenced, pid_type):
59
- """Assert that given PID is contained in one of the referenced."""
60
- found = False
61
- for r in referenced:
62
- if r["pid_type"] == pid_type:
63
- found = True
64
- break
65
- assert found
66
-
67
- def test_on_document_update():
68
- """Test document resolvers."""
69
- indexer = _get_mock()
70
-
71
- pid = "docid-2"
72
- document = Document.get_record_by_pid(pid)
73
- DocumentIndexer().index(document)
74
-
75
- referenced = _assert_origin(indexer, DOCUMENT_PID_TYPE, pid)
76
-
77
- # should re-index document request
78
- n_doc_req = 1 # from test data
79
- _assert_contains(referenced, DOCUMENT_REQUEST_PID_TYPE)
80
-
81
- # should re-index eitem
82
- n_eitems = 1 # from test data
83
- _assert_contains(referenced, EITEM_PID_TYPE)
84
-
85
- # should re-index item
86
- n_items = 1 # from test data
87
- _assert_contains(referenced, ITEM_PID_TYPE)
88
-
89
- # should re-index acq
90
- n_acq = 1 # from test data
91
- _assert_contains(referenced, ORDER_PID_TYPE)
92
-
93
- # should re-index ill
94
- n_ill = 1 # from test data
95
- _assert_contains(referenced, BORROWING_REQUEST_PID_TYPE)
96
-
97
- expected_total = n_doc_req + n_eitems + n_items + n_acq + n_ill
98
- assert len(referenced) == expected_total
99
-
100
- def test_on_eitem_update():
101
- """Test eitem resolvers."""
102
- indexer = _get_mock()
103
-
104
- pid = "eitemid-1"
105
- eitem = EItem.get_record_by_pid(pid)
106
- EItemIndexer().index(eitem)
107
-
108
- referenced = _assert_origin(indexer, EITEM_PID_TYPE, pid)
109
-
110
- # should re-index documents
111
- n_documents = 1 # from test data
112
- _assert_contains(referenced, DOCUMENT_PID_TYPE)
113
-
114
- assert len(referenced) == n_documents
115
-
116
- def test_on_internal_location_update():
117
- """Test internal location resolvers."""
118
- indexer = _get_mock()
119
-
120
- pid = "ilocid-2"
121
- intloc = InternalLocation.get_record_by_pid(pid)
122
- InternalLocationIndexer().index(intloc)
123
-
124
- referenced = _assert_origin(indexer, INTERNAL_LOCATION_PID_TYPE, pid)
125
-
126
- # should re-index items
127
- n_items = 4 # from test data
128
- _assert_contains(referenced, ITEM_PID_TYPE)
129
-
130
- assert len(referenced) == n_items
131
-
132
- def test_on_item_update():
133
- """Test item resolvers."""
134
- indexer = _get_mock()
135
-
136
- # item on loan
137
- pid = "itemid-56"
138
- item = Item.get_record_by_pid(pid)
139
- ItemIndexer().index(item)
140
-
141
- referenced = _assert_origin(indexer, ITEM_PID_TYPE, pid)
142
-
143
- # should re-index loans
144
- n_loans = 2 # from test data, including pending
145
- _assert_contains(referenced, CIRCULATION_LOAN_PID_TYPE)
146
-
147
- # should re-index document
148
- n_documents = 1 # from test data
149
- _assert_contains(referenced, DOCUMENT_PID_TYPE)
150
-
151
- assert len(referenced) == n_loans + n_documents
152
-
153
- def test_on_location_update():
154
- """Test location resolvers."""
155
- indexer = _get_mock()
156
-
157
- pid = "locid-2"
158
- loc = Location.get_record_by_pid(pid)
159
- LocationIndexer().index(loc)
160
-
161
- referenced = _assert_origin(indexer, LOCATION_PID_TYPE, pid)
162
-
163
- # should re-index internal locations
164
- n_intlocs = 1 # from test data
165
- _assert_contains(referenced, INTERNAL_LOCATION_PID_TYPE)
166
-
167
- # should re-index internal items
168
- n_items = 1 # from test data
169
- _assert_contains(referenced, ITEM_PID_TYPE)
170
-
171
- assert len(referenced) == n_intlocs + n_items
172
-
173
- def test_on_patron_update():
174
- """Test patron resolvers."""
175
- indexer = _get_mock()
176
-
177
- pid = "2"
178
- patron = Patron.get_patron(pid)
179
- PatronIndexer().index(patron)
180
-
181
- referenced = _assert_origin(indexer, PATRON_PID_TYPE, pid)
182
-
183
- # should re-index loans
184
- n_loans = 3 # from test data
185
- _assert_contains(referenced, CIRCULATION_LOAN_PID_TYPE)
186
-
187
- # should re-index document request
188
- n_doc_req = 1 # from test data
189
- _assert_contains(referenced, DOCUMENT_REQUEST_PID_TYPE)
190
-
191
- # should re-index acq
192
- n_acq = 1 # from test data
193
- _assert_contains(referenced, ORDER_PID_TYPE)
194
-
195
- # should re-index ill
196
- n_ill = 3 # from test data
197
- _assert_contains(referenced, BORROWING_REQUEST_PID_TYPE)
198
-
199
- expected_total = n_loans + n_doc_req + n_acq + n_ill
200
- assert len(referenced) == expected_total
201
-
202
- test_on_document_update()
203
- test_on_eitem_update()
204
- test_on_internal_location_update()
205
- test_on_item_update()
206
- test_on_location_update()
207
- test_on_patron_update()
@@ -1,160 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2019 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."""
9
-
10
- import json
11
-
12
- from flask import url_for
13
- from invenio_db import db
14
-
15
- from invenio_app_ils.signals import record_viewed
16
- from tests.helpers import user_login, user_logout
17
-
18
-
19
- def _most_loaned_request(client, json_headers, from_date=None, to_date=None):
20
- """Perform a stats request."""
21
- params = []
22
- if from_date is not None:
23
- params.append("from_date={}".format(from_date))
24
- if to_date is not None:
25
- params.append("to_date={}".format(to_date))
26
- response = client.get(
27
- "{}?{}".format(
28
- url_for("invenio_app_ils_circulation_stats.most-loaned"),
29
- "&".join(params),
30
- ),
31
- headers=json_headers,
32
- )
33
- return json.loads(response.data.decode("utf-8"))
34
-
35
-
36
- def _assert_most_loaned(client, json_headers, from_date, to_date, expect):
37
- """Assert most loaned request."""
38
- resp = _most_loaned_request(client, json_headers, from_date, to_date)
39
- hits = resp["hits"]["hits"]
40
- assert len(hits) == len(expect)
41
- for hit in hits:
42
- pid = hit["metadata"]["pid"]
43
- assert hit["metadata"]["loan_count"] == expect[pid]["loans"]
44
- assert hit["metadata"]["loan_extensions"] == expect[pid]["extensions"]
45
-
46
-
47
- def test_stats_most_loaned_documents(
48
- client, json_headers, testdata_most_loaned, users
49
- ):
50
- """Test most loaned documents API endpoint."""
51
- user_login(client, "librarian", users)
52
-
53
- # Dates covering all loans
54
- _assert_most_loaned(
55
- client,
56
- json_headers,
57
- "2019-01-01",
58
- "2019-12-01",
59
- expect={
60
- "docid-1": dict(loans=3, extensions=0),
61
- "docid-2": dict(loans=1, extensions=1),
62
- "docid-3": dict(loans=2, extensions=6),
63
- "docid-5": dict(loans=1, extensions=0),
64
- },
65
- )
66
- # Test checking range which should be empty
67
- _assert_most_loaned(
68
- client, json_headers, "2019-01-01", "2019-01-01", expect={}
69
- )
70
- # Test range only including the first loan
71
- _assert_most_loaned(
72
- client,
73
- json_headers,
74
- "2019-01-01",
75
- "2019-01-03",
76
- expect={"docid-1": dict(loans=1, extensions=0)},
77
- )
78
- _assert_most_loaned(
79
- client,
80
- json_headers,
81
- "2019-02-02",
82
- "2019-03-02",
83
- expect={
84
- "docid-1": dict(loans=2, extensions=0),
85
- "docid-2": dict(loans=1, extensions=1),
86
- "docid-3": dict(loans=1, extensions=3),
87
- },
88
- )
89
- _assert_most_loaned(
90
- client,
91
- json_headers,
92
- "2019-05-20",
93
- "2019-08-22",
94
- expect={"docid-3": dict(loans=1, extensions=3)},
95
- )
96
- # outside end range
97
- _assert_most_loaned(
98
- client, json_headers, "2019-05-21", "2019-12-31", expect={}
99
- )
100
-
101
-
102
- def test_stats_downloads_views_permissions(
103
- client, json_headers, users, testdata, mocker
104
- ):
105
- """Test permissions on downloads/views stats."""
106
-
107
- # mock record_viewed signal because travis timed out and the signal does
108
- # not need to be tested here
109
- mocker.patch(
110
- "invenio_app_ils.signals.record_viewed.send",
111
- )
112
-
113
- url_open_access = url_for(
114
- "ils_document_stats.docid_stats", pid_value="docid-open-access"
115
- )
116
- url_closed_access = url_for(
117
- "ils_document_stats.docid_stats", pid_value="docid-closed-access"
118
- )
119
- params = {}
120
- params["event"] = "record-view"
121
-
122
- # permission for librarian
123
- user_login(client, "librarian", users)
124
- res = client.post(
125
- url_open_access, headers=json_headers, data=json.dumps(params)
126
- )
127
- assert res.status_code == 202
128
-
129
- res = client.post(
130
- url_closed_access, headers=json_headers, data=json.dumps(params)
131
- )
132
- assert res.status_code == 202
133
-
134
- user_logout(client)
135
-
136
- # permission for patron
137
- user_login(client, "patron1", users)
138
-
139
- res = client.post(
140
- url_open_access, headers=json_headers, data=json.dumps(params)
141
- )
142
- assert res.status_code == 202
143
-
144
- res = client.post(
145
- url_closed_access, headers=json_headers, data=json.dumps(params)
146
- )
147
- assert res.status_code == 403
148
-
149
- user_logout(client)
150
-
151
- # permission for unauthenticated user
152
- res = client.post(
153
- url_open_access, headers=json_headers, data=json.dumps(params)
154
- )
155
- assert res.status_code == 202
156
-
157
- res = client.post(
158
- url_closed_access, headers=json_headers, data=json.dumps(params)
159
- )
160
- assert res.status_code == 401
@@ -1,211 +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 location closure cronjobs."""
9
-
10
- import time
11
-
12
- import arrow
13
- from invenio_circulation.proxies import current_circulation
14
-
15
- from invenio_app_ils.circulation.search import get_active_loans
16
- from invenio_app_ils.closures.tasks import (
17
- clean_locations_past_closures_exceptions,
18
- extend_active_loans_location_closure,
19
- )
20
- from invenio_app_ils.proxies import current_app_ils
21
-
22
- _LOCATION_PID_1 = "locid-1"
23
- _LOCATION_PID_2 = "locid-2"
24
- _LOAN_PID_1 = "loanid-6"
25
- _LOAN_PID_2 = "loanid-5"
26
-
27
-
28
- _OPENING_EXCEPTIONS_WITH_PAST_EXCEPTIONS = [
29
- {
30
- "title": "Past holidays",
31
- "is_open": False,
32
- "start_date": "2010-01-01",
33
- "end_date": "2010-01-06",
34
- },
35
- {
36
- "title": "Past holidays",
37
- "is_open": False,
38
- "start_date": "2013-04-05",
39
- "end_date": "2013-04-08",
40
- },
41
- {
42
- "title": "Past holiday",
43
- "is_open": False,
44
- "start_date": "2005-05-14",
45
- "end_date": "2005-05-16",
46
- },
47
- {
48
- "title": "Past holidays",
49
- "is_open": False,
50
- "start_date": "2019-02-01",
51
- "end_date": "2019-02-06",
52
- },
53
- {
54
- "title": "Future holidays",
55
- "is_open": False,
56
- "start_date": "2100-02-11",
57
- "end_date": "2100-02-12",
58
- },
59
- {
60
- "title": "Future holidays",
61
- "is_open": False,
62
- "start_date": "2100-03-01",
63
- "end_date": "2100-03-06",
64
- },
65
- ]
66
-
67
- _OPENING_EXCEPTIONS_WITHOUT_CHANGES = [
68
- {
69
- "title": "Future holidays",
70
- "is_open": False,
71
- "start_date": "2110-01-01",
72
- "end_date": "2110-01-06",
73
- },
74
- {
75
- "title": "Future holidays",
76
- "is_open": False,
77
- "start_date": "2113-04-05",
78
- "end_date": "2113-04-08",
79
- },
80
- {
81
- "title": "Future holidays",
82
- "is_open": False,
83
- "start_date": "2105-05-14",
84
- "end_date": "2105-05-16",
85
- },
86
- {
87
- "title": "Future holidays",
88
- "is_open": False,
89
- "start_date": "2119-02-01",
90
- "end_date": "2119-02-06",
91
- },
92
- {
93
- "title": "Future holidays",
94
- "is_open": False,
95
- "start_date": "2100-02-11",
96
- "end_date": "2100-02-12",
97
- },
98
- {
99
- "title": "Future holidays",
100
- "is_open": False,
101
- "start_date": "2100-03-01",
102
- "end_date": "2100-03-06",
103
- },
104
- ]
105
-
106
-
107
- def prepare_data(db, location_pid, opening_exceptions):
108
- """Adds some opening exceptions to a concrete location."""
109
-
110
- location = current_app_ils.location_record_cls
111
- record = location.get_record_by_pid(location_pid)
112
-
113
- record.update({"opening_exceptions": opening_exceptions})
114
- record.commit()
115
- db.session.commit()
116
- current_app_ils.location_indexer.index(record)
117
-
118
-
119
- def prepare_loans_data(db, testdata):
120
- """Updates the expire date of a loan to match a closure day."""
121
- loans = testdata["loans"]
122
-
123
- def new_expiration_date(loan_test_data, date):
124
- loan = current_circulation.loan_record_cls.get_record_by_pid(
125
- loan_test_data["pid"]
126
- )
127
- loan.update(end_date=date.isoformat())
128
- loan.commit()
129
- db.session.commit()
130
- current_circulation.loan_indexer().index(loan)
131
-
132
- # Change expiration date to match closure
133
- date = arrow.get("2100-03-03").date()
134
- date_2 = arrow.get("2100-02-12").date()
135
- new_expiration_date(loans[5], date)
136
- new_expiration_date(loans[4], date_2)
137
-
138
-
139
- def opening_exceptions_cleaned():
140
- """Prepare data that should match with the response."""
141
- opening_exceptions = [
142
- {
143
- "title": "Future holidays",
144
- "is_open": False,
145
- "start_date": "2100-02-11",
146
- "end_date": "2100-02-12",
147
- },
148
- {
149
- "title": "Future holidays",
150
- "is_open": False,
151
- "start_date": "2100-03-01",
152
- "end_date": "2100-03-06",
153
- },
154
- ]
155
-
156
- return opening_exceptions
157
-
158
-
159
- def test_clean_locations_past_closures_exceptions(db, users, testdata):
160
- """Test cleaning of past exceptions."""
161
- prepare_data(db, _LOCATION_PID_1, _OPENING_EXCEPTIONS_WITH_PAST_EXCEPTIONS)
162
- prepare_data(db, _LOCATION_PID_2, _OPENING_EXCEPTIONS_WITH_PAST_EXCEPTIONS)
163
- clean_locations_past_closures_exceptions()
164
- location = current_app_ils.location_record_cls
165
- record = location.get_record_by_pid(_LOCATION_PID_1)
166
- record_2 = location.get_record_by_pid(_LOCATION_PID_2)
167
-
168
- assert record["opening_exceptions"] == opening_exceptions_cleaned()
169
- assert record_2["opening_exceptions"] == opening_exceptions_cleaned()
170
-
171
-
172
- def test_no_changes_on_loans(db, users, testdata):
173
- """Test that no changes are applied to the loans if not needed."""
174
- prepare_data(db, _LOCATION_PID_1, _OPENING_EXCEPTIONS_WITHOUT_CHANGES)
175
- loans = testdata["loans"]
176
- clean_locations_past_closures_exceptions()
177
- for hit in get_active_loans().scan():
178
- for loan in loans:
179
- if hit["pid"] == loan["pid"]:
180
- assert hit["end_date"] == loan["end_date"]
181
-
182
-
183
- def test_no_changes_on_exceptions(db, users, testdata):
184
- """Test that no changes are applied to the exceptions if not needed."""
185
- prepare_data(db, _LOCATION_PID_1, _OPENING_EXCEPTIONS_WITHOUT_CHANGES)
186
- extend_active_loans_location_closure(_LOCATION_PID_1)
187
- location = current_app_ils.location_record_cls
188
- record = location.get_record_by_pid(_LOCATION_PID_1)
189
- record_2 = location.get_record_by_pid(_LOCATION_PID_2)
190
-
191
- assert record["opening_exceptions"] == _OPENING_EXCEPTIONS_WITHOUT_CHANGES
192
- assert record_2["opening_exceptions"] == []
193
-
194
-
195
- def test_extend_active_loans_location_closure(
196
- db, users, testdata, app_with_notifs
197
- ):
198
- """Test extension of active loans that finish on holidays."""
199
- prepare_data(db, _LOCATION_PID_1, _OPENING_EXCEPTIONS_WITH_PAST_EXCEPTIONS)
200
- prepare_loans_data(db, testdata)
201
- time.sleep(3)
202
-
203
- with app_with_notifs.extensions["mail"].record_messages() as outbox:
204
- assert len(outbox) == 0
205
- extend_active_loans_location_closure(_LOCATION_PID_1)
206
- assert len(outbox) == 2
207
-
208
- loan = current_circulation.loan_record_cls.get_record_by_pid(_LOAN_PID_1)
209
- loan_2 = current_circulation.loan_record_cls.get_record_by_pid(_LOAN_PID_2)
210
- assert loan["end_date"] == "2100-03-07"
211
- assert loan_2["end_date"] == "2100-02-13"
@@ -1,35 +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 vocabularies endpoint."""
9
- import json
10
-
11
- from flask import url_for
12
-
13
- from tests.helpers import user_login
14
-
15
- LIST_ENDPOINT = "invenio_records_rest.vocid_list"
16
-
17
-
18
- def test_vocabularies_permissions(client, testdata, json_headers, users):
19
- """Test vocabularies endpoints permissions."""
20
- tests = [
21
- ("admin", [200]),
22
- ("librarian", [200]),
23
- ("patron1", [200]),
24
- ("anonymous", [401]),
25
- ]
26
-
27
- def _test_list(expected_status):
28
- """Test get list."""
29
- url = url_for(LIST_ENDPOINT)
30
- res = client.get(url, headers=json_headers)
31
- assert res.status_code in expected_status
32
-
33
- for username, codes in tests:
34
- user_login(client, username, users)
35
- _test_list(codes)