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.
- invenio_app_ils/__init__.py +2 -2
- invenio_app_ils/acquisition/api.py +3 -1
- invenio_app_ils/acquisition/config.py +10 -21
- invenio_app_ils/acquisition/jsonresolvers/order_order_lines.py +1 -0
- invenio_app_ils/acquisition/mappings/os-v1/acq_orders/order-v1.0.0.json +364 -0
- invenio_app_ils/acquisition/mappings/os-v2/__init__.py +0 -0
- invenio_app_ils/acquisition/mappings/os-v2/acq_orders/order-v1.0.0.json +364 -0
- invenio_app_ils/acquisition/mappings/v7/acq_orders/order-v1.0.0.json +14 -0
- invenio_app_ils/acquisition/search.py +5 -15
- invenio_app_ils/assets/semantic-ui/less/theme.config +103 -0
- invenio_app_ils/assets/semantic-ui/templates/.gitkeep +0 -0
- invenio_app_ils/circulation/api.py +153 -67
- invenio_app_ils/circulation/config.py +29 -25
- invenio_app_ils/circulation/indexer.py +14 -19
- invenio_app_ils/circulation/loaders/__init__.py +2 -0
- invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py +2 -3
- invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +82 -16
- invenio_app_ils/circulation/loaders/schemas/json/loan_self_checkout.py +19 -0
- invenio_app_ils/circulation/notifications/api.py +23 -19
- invenio_app_ils/circulation/notifications/messages.py +6 -6
- invenio_app_ils/circulation/notifications/tasks.py +1 -2
- invenio_app_ils/circulation/receivers.py +2 -5
- invenio_app_ils/circulation/search.py +23 -22
- invenio_app_ils/circulation/serializers/__init__.py +2 -2
- invenio_app_ils/circulation/serializers/csv.py +1 -3
- invenio_app_ils/circulation/serializers/custom_fields.py +5 -9
- invenio_app_ils/circulation/serializers/json.py +2 -6
- invenio_app_ils/circulation/serializers/response.py +12 -12
- invenio_app_ils/circulation/stats/views.py +5 -15
- invenio_app_ils/circulation/tasks.py +2 -6
- invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/self_checkout.html +19 -0
- invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/update_dates.html +19 -0
- invenio_app_ils/circulation/utils.py +23 -17
- invenio_app_ils/circulation/views.py +103 -39
- invenio_app_ils/cli.py +220 -260
- invenio_app_ils/closures/api.py +72 -7
- invenio_app_ils/closures/serializers/__init__.py +16 -0
- invenio_app_ils/closures/serializers/response.py +35 -0
- invenio_app_ils/closures/serializers/schema.py +28 -0
- invenio_app_ils/closures/tasks.py +4 -11
- invenio_app_ils/closures/views.py +66 -0
- invenio_app_ils/config.py +207 -150
- invenio_app_ils/document_requests/api.py +6 -21
- invenio_app_ils/document_requests/loaders/__init__.py +4 -12
- invenio_app_ils/document_requests/mappings/{v6 → os-v1}/__init__.py +2 -2
- invenio_app_ils/document_requests/mappings/os-v1/document_requests/document_request-v1.0.0.json +196 -0
- invenio_app_ils/document_requests/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/document_requests/mappings/os-v2/document_requests/document_request-v1.0.0.json +196 -0
- invenio_app_ils/document_requests/notifications/api.py +2 -7
- invenio_app_ils/document_requests/notifications/messages.py +3 -7
- invenio_app_ils/document_requests/search.py +2 -6
- invenio_app_ils/document_requests/views.py +4 -10
- invenio_app_ils/documents/api.py +19 -25
- invenio_app_ils/documents/indexer.py +13 -20
- invenio_app_ils/documents/jsonresolvers/document_circulation.py +11 -33
- invenio_app_ils/documents/jsonresolvers/document_eitem.py +1 -0
- invenio_app_ils/documents/jsonresolvers/document_item.py +8 -9
- invenio_app_ils/documents/jsonresolvers/document_stock.py +7 -7
- invenio_app_ils/documents/loaders/jsonschemas/document.py +3 -14
- invenio_app_ils/documents/mappings/{v6 → os-v1}/__init__.py +1 -1
- invenio_app_ils/documents/mappings/os-v1/documents/document-v1.0.0.json +932 -0
- invenio_app_ils/documents/mappings/os-v1/documents/document-v2.0.0.json +1066 -0
- invenio_app_ils/documents/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/documents/mappings/os-v2/documents/document-v1.0.0.json +932 -0
- invenio_app_ils/documents/mappings/os-v2/documents/document-v2.0.0.json +1066 -0
- invenio_app_ils/documents/mappings/v7/documents/document-v1.0.0.json +102 -11
- invenio_app_ils/documents/mappings/v7/documents/document-v2.0.0.json +1066 -0
- invenio_app_ils/documents/schemas/documents/document-v2.0.0.json +732 -0
- invenio_app_ils/eitems/api.py +41 -7
- invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +6 -6
- invenio_app_ils/eitems/mappings/{v6 → os-v1}/__init__.py +1 -1
- invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v1.0.0.json +139 -0
- invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v2.0.0.json +142 -0
- invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v3.0.0.json +179 -0
- invenio_app_ils/{series/mappings/v6 → eitems/mappings/os-v2}/__init__.py +1 -1
- invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v1.0.0.json +139 -0
- invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v2.0.0.json +142 -0
- invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v3.0.0.json +179 -0
- invenio_app_ils/eitems/mappings/v7/eitems/eitem-v1.0.0.json +12 -2
- invenio_app_ils/eitems/mappings/v7/eitems/eitem-v2.0.0.json +142 -0
- invenio_app_ils/eitems/mappings/v7/eitems/eitem-v3.0.0.json +179 -0
- invenio_app_ils/eitems/schemas/eitems/eitem-v2.0.0.json +120 -0
- invenio_app_ils/eitems/schemas/eitems/eitem-v3.0.0.json +120 -0
- invenio_app_ils/eitems/search.py +3 -9
- invenio_app_ils/errors.py +119 -6
- invenio_app_ils/ext.py +15 -18
- invenio_app_ils/facets.py +13 -15
- invenio_app_ils/files/receivers.py +1 -1
- invenio_app_ils/files/views.py +1 -2
- invenio_app_ils/ill/api.py +1 -2
- invenio_app_ils/ill/config.py +10 -16
- invenio_app_ils/ill/jsonresolvers/borrowing_request_document.py +2 -3
- invenio_app_ils/ill/jsonresolvers/borrowing_request_patron.py +1 -3
- invenio_app_ils/ill/jsonresolvers/borrowing_request_provider.py +1 -3
- invenio_app_ils/ill/loaders/__init__.py +3 -9
- invenio_app_ils/ill/loaders/jsonschemas/patron_loan_actions.py +1 -8
- invenio_app_ils/ill/loaders/jsonschemas/patron_loan_extension_actions.py +3 -8
- invenio_app_ils/ill/mappings/{v6 → os-v1}/__init__.py +1 -1
- invenio_app_ils/ill/mappings/os-v1/ill_borrowing_requests/borrowing_request-v1.0.0.json +254 -0
- invenio_app_ils/{acquisition/mappings/v6 → ill/mappings/os-v2}/__init__.py +1 -1
- invenio_app_ils/ill/mappings/os-v2/ill_borrowing_requests/borrowing_request-v1.0.0.json +254 -0
- invenio_app_ils/ill/mappings/v7/ill_borrowing_requests/borrowing_request-v1.0.0.json +14 -0
- invenio_app_ils/ill/notifications/api.py +1 -4
- invenio_app_ils/ill/search.py +3 -9
- invenio_app_ils/ill/serializers/__init__.py +1 -3
- invenio_app_ils/ill/views.py +2 -4
- invenio_app_ils/internal_locations/api.py +1 -4
- invenio_app_ils/internal_locations/mappings/{v6 → os-v1}/__init__.py +1 -1
- invenio_app_ils/internal_locations/mappings/os-v1/internal_locations/internal_location-v1.0.0.json +108 -0
- invenio_app_ils/internal_locations/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/internal_locations/mappings/os-v2/internal_locations/internal_location-v1.0.0.json +108 -0
- invenio_app_ils/internal_locations/search.py +1 -3
- invenio_app_ils/items/api.py +18 -15
- invenio_app_ils/items/indexer.py +1 -3
- invenio_app_ils/items/jsonresolvers/item_document.py +1 -1
- invenio_app_ils/items/jsonresolvers/item_internal_location.py +2 -6
- invenio_app_ils/items/loaders/jsonschemas/items.py +2 -0
- {tests/api/circulation → invenio_app_ils/items/mappings/os-v1}/__init__.py +1 -1
- invenio_app_ils/items/mappings/os-v1/items/item-v1.0.0.json +285 -0
- invenio_app_ils/items/mappings/os-v1/items/item-v2.0.0.json +326 -0
- {tests/api/ill → invenio_app_ils/items/mappings/os-v2}/__init__.py +1 -1
- invenio_app_ils/items/mappings/os-v2/items/item-v1.0.0.json +285 -0
- invenio_app_ils/items/mappings/os-v2/items/item-v2.0.0.json +326 -0
- invenio_app_ils/items/mappings/v7/items/item-v1.0.0.json +11 -0
- invenio_app_ils/items/mappings/v7/items/item-v2.0.0.json +326 -0
- invenio_app_ils/items/schemas/items/item-v1.0.0.json +22 -0
- invenio_app_ils/items/schemas/items/item-v2.0.0.json +172 -0
- invenio_app_ils/items/search.py +18 -11
- invenio_app_ils/items/serializers/item.py +7 -6
- invenio_app_ils/literature/api.py +1 -3
- invenio_app_ils/literature/search.py +3 -5
- invenio_app_ils/literature/serializers/csv.py +1 -3
- invenio_app_ils/literature/serializers/json.py +1 -3
- invenio_app_ils/locations/api.py +2 -4
- invenio_app_ils/locations/indexer.py +3 -9
- invenio_app_ils/locations/loaders/__init__.py +1 -3
- invenio_app_ils/locations/loaders/jsonschemas/location.py +4 -11
- invenio_app_ils/locations/mappings/{v6 → os-v1}/__init__.py +1 -1
- invenio_app_ils/locations/mappings/os-v1/locations/location-v1.0.0.json +90 -0
- invenio_app_ils/locations/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/locations/mappings/os-v2/locations/location-v1.0.0.json +90 -0
- invenio_app_ils/notifications/messages.py +4 -3
- invenio_app_ils/notifications/tasks.py +1 -3
- invenio_app_ils/notifications/views.py +2 -2
- invenio_app_ils/patrons/anonymization.py +53 -32
- invenio_app_ils/patrons/api.py +3 -5
- invenio_app_ils/patrons/cli.py +1 -2
- invenio_app_ils/patrons/indexer.py +4 -13
- invenio_app_ils/patrons/mappings/os-v1/__init__.py +8 -0
- invenio_app_ils/patrons/mappings/os-v1/patrons/patron-v1.0.0.json +42 -0
- invenio_app_ils/patrons/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/patrons/mappings/os-v2/patrons/patron-v1.0.0.json +42 -0
- invenio_app_ils/patrons/views.py +4 -14
- invenio_app_ils/permissions.py +93 -35
- invenio_app_ils/providers/api.py +2 -6
- invenio_app_ils/providers/config.py +11 -19
- invenio_app_ils/providers/indexer.py +2 -6
- invenio_app_ils/providers/mappings/{v6 → os-v1}/__init__.py +1 -1
- invenio_app_ils/providers/mappings/os-v1/providers/provider-v1.0.0.json +57 -0
- invenio_app_ils/providers/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/providers/mappings/os-v2/providers/provider-v1.0.0.json +57 -0
- invenio_app_ils/providers/mappings/v7/__init__.py +1 -1
- invenio_app_ils/providers/proxies.py +1 -3
- invenio_app_ils/records/api.py +3 -9
- invenio_app_ils/records/loaders/schemas/changed_by.py +1 -3
- invenio_app_ils/records/loaders/schemas/identifiers.py +23 -0
- invenio_app_ils/records/metadata_extensions.py +1 -4
- invenio_app_ils/records/permissions.py +8 -2
- invenio_app_ils/records/serializers/__init__.py +1 -4
- invenio_app_ils/records/views.py +4 -7
- invenio_app_ils/records_relations/api.py +11 -34
- invenio_app_ils/records_relations/indexer.py +1 -3
- invenio_app_ils/records_relations/retriever.py +14 -9
- invenio_app_ils/records_relations/views.py +16 -50
- invenio_app_ils/relations/api.py +17 -16
- invenio_app_ils/search_permissions.py +24 -24
- invenio_app_ils/series/api.py +10 -12
- invenio_app_ils/series/loaders/jsonschemas/series.py +3 -2
- invenio_app_ils/{items/mappings/v6 → series/mappings/os-v1}/__init__.py +1 -1
- invenio_app_ils/series/mappings/os-v1/series/series-v1.0.0.json +324 -0
- invenio_app_ils/series/mappings/os-v1/series/series-v2.0.0.json +396 -0
- {tests/api/acquisition → invenio_app_ils/series/mappings/os-v2}/__init__.py +1 -1
- invenio_app_ils/series/mappings/os-v2/series/series-v1.0.0.json +324 -0
- invenio_app_ils/series/mappings/os-v2/series/series-v2.0.0.json +396 -0
- invenio_app_ils/series/mappings/v7/series/series-v1.0.0.json +35 -3
- invenio_app_ils/series/mappings/v7/series/series-v2.0.0.json +396 -0
- invenio_app_ils/series/schemas/series/series-v2.0.0.json +354 -0
- invenio_app_ils/stats/aggregations/aggr_file_download/os-v1/aggr-file-download-v1.json +60 -0
- invenio_app_ils/stats/aggregations/aggr_file_download/os-v2/__init__.py +9 -0
- invenio_app_ils/stats/aggregations/aggr_file_download/os-v2/aggr-file-download-v1.json +60 -0
- invenio_app_ils/stats/event_builders.py +73 -0
- invenio_app_ils/stats/file_download/os-v1/file-download-v1.json +72 -0
- invenio_app_ils/stats/file_download/os-v2/__init__.py +9 -0
- invenio_app_ils/stats/file_download/os-v2/file-download-v1.json +72 -0
- invenio_app_ils/stats/processors.py +30 -0
- invenio_app_ils/stats/templates/aggregations/__init__.py +8 -0
- invenio_app_ils/stats/templates/aggregations/ils_record_changes/__init__.py +8 -0
- invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/__init__.py +8 -0
- invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/aggr-ils-record-changes-v1.json +41 -0
- {tests → invenio_app_ils/stats/templates/events}/__init__.py +2 -2
- invenio_app_ils/stats/templates/events/ils_record_changes/__init__.py +8 -0
- invenio_app_ils/stats/templates/events/ils_record_changes/os-v2/__init__.py +8 -0
- invenio_app_ils/stats/templates/events/ils_record_changes/os-v2/ils-record-changes-v1.json +41 -0
- invenio_app_ils/templates/logged_out.html +12 -0
- invenio_app_ils/views.py +18 -4
- invenio_app_ils/vocabularies/api.py +1 -1
- invenio_app_ils/vocabularies/cli.py +6 -18
- invenio_app_ils/vocabularies/data/acq_order_line_payment_modes.json +5 -0
- invenio_app_ils/vocabularies/data/identifier_schemes.json +5 -0
- invenio_app_ils/vocabularies/indexer.py +1 -4
- invenio_app_ils/vocabularies/jsonresolvers/licenses.py +2 -11
- invenio_app_ils/vocabularies/mappings/os-v1/__init__.py +8 -0
- invenio_app_ils/vocabularies/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +23 -0
- invenio_app_ils/vocabularies/mappings/os-v2/__init__.py +8 -0
- invenio_app_ils/vocabularies/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +23 -0
- invenio_app_ils/vocabularies/sources/base.py +1 -3
- invenio_app_ils/webpack.py +27 -0
- invenio_app_ils-6.1.0.dist-info/METADATA +627 -0
- {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/RECORD +227 -249
- {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/WHEEL +1 -1
- {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/entry_points.txt +9 -5
- {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/top_level.txt +0 -1
- invenio_app_ils/acquisition/mappings/v6/acq_orders/order-v1.0.0.json +0 -352
- invenio_app_ils/document_requests/mappings/v6/document_requests/document_request-v1.0.0.json +0 -199
- invenio_app_ils/documents/mappings/v6/documents/document-v1.0.0.json +0 -843
- invenio_app_ils/eitems/mappings/v6/eitems/eitem-v1.0.0.json +0 -131
- invenio_app_ils/ill/mappings/v6/ill_borrowing_requests/borrowing_request-v1.0.0.json +0 -242
- invenio_app_ils/internal_locations/mappings/v6/internal_locations/internal_location-v1.0.0.json +0 -110
- invenio_app_ils/items/mappings/v6/items/item-v1.0.0.json +0 -276
- invenio_app_ils/locations/mappings/v6/locations/location-v1.0.0.json +0 -92
- invenio_app_ils/notifications/admin.py +0 -57
- invenio_app_ils/patrons/mappings/v6/__init__.py +0 -8
- invenio_app_ils/patrons/mappings/v6/patrons/patron-v1.0.0.json +0 -44
- invenio_app_ils/providers/mappings/v6/providers/provider-v1.0.0.json +0 -59
- invenio_app_ils/series/mappings/v6/series/series-v1.0.0.json +0 -298
- invenio_app_ils/stats/aggregations/aggr_file_download/v6/aggr-file-download-v1.json +0 -59
- invenio_app_ils/stats/file_download/v6/file-download-v1.json +0 -74
- invenio_app_ils/version.py +0 -14
- invenio_app_ils/vocabularies/mappings/v6/__init__.py +0 -8
- invenio_app_ils/vocabularies/mappings/v6/vocabularies/vocabulary-v1.0.0.json +0 -25
- invenio_app_ils-1.0.0a54.dist-info/METADATA +0 -95
- tests/api/__init__.py +0 -8
- tests/api/acquisition/test_acq_orders_crud.py +0 -102
- tests/api/acquisition/test_acq_orders_permissions.py +0 -104
- tests/api/acquisition/test_acq_providers_permissions.py +0 -83
- tests/api/circulation/test_expired_loans.py +0 -88
- tests/api/circulation/test_loan_checkout.py +0 -216
- tests/api/circulation/test_loan_default_durations.py +0 -57
- tests/api/circulation/test_loan_document_resolver.py +0 -18
- tests/api/circulation/test_loan_extend.py +0 -132
- tests/api/circulation/test_loan_item_permissions.py +0 -139
- tests/api/circulation/test_loan_item_resolver.py +0 -26
- tests/api/circulation/test_loan_list_permissions.py +0 -104
- tests/api/circulation/test_loan_patron_resolver.py +0 -38
- tests/api/circulation/test_loan_request.py +0 -234
- tests/api/circulation/test_loan_update.py +0 -150
- tests/api/circulation/test_notifications.py +0 -229
- tests/api/conftest.py +0 -236
- tests/api/document_requests/__init__.py +0 -8
- tests/api/document_requests/test_document_requests.py +0 -131
- tests/api/document_requests/test_document_requests_permissions.py +0 -177
- tests/api/document_requests/test_notifications_filter.py +0 -36
- tests/api/ill/test_ill_brw_crud.py +0 -84
- tests/api/ill/test_ill_brw_reqs_patron_loan_create_action.py +0 -207
- tests/api/ill/test_ill_brw_reqs_patron_loan_extension_actions.py +0 -298
- tests/api/ill/test_ill_brw_reqs_permissions.py +0 -169
- tests/api/ill/test_ill_providers_permissions.py +0 -82
- tests/api/ils/__init__.py +0 -8
- tests/api/ils/documents/__init__.py +0 -8
- tests/api/ils/documents/test_document_crud.py +0 -57
- tests/api/ils/documents/test_document_permissions.py +0 -106
- tests/api/ils/documents/test_document_resolvers.py +0 -35
- tests/api/ils/eitems/__init__.py +0 -8
- tests/api/ils/eitems/test_eitems_crud.py +0 -41
- tests/api/ils/eitems/test_eitems_permissions.py +0 -84
- tests/api/ils/eitems/test_files.py +0 -172
- tests/api/ils/items/__init__.py +0 -8
- tests/api/ils/items/test_apis.py +0 -43
- tests/api/ils/items/test_items_crud.py +0 -60
- tests/api/ils/items/test_items_permissions.py +0 -107
- tests/api/ils/items/test_items_update.py +0 -47
- tests/api/ils/records_relations/__init__.py +0 -8
- tests/api/ils/records_relations/helpers.py +0 -115
- tests/api/ils/records_relations/test_records_relations_parentchild.py +0 -560
- tests/api/ils/records_relations/test_records_relations_sequence.py +0 -302
- tests/api/ils/records_relations/test_records_relations_siblings.py +0 -678
- tests/api/ils/series/__init__.py +0 -8
- tests/api/ils/series/test_series_permissions.py +0 -95
- tests/api/ils/test_anonymization.py +0 -189
- tests/api/ils/test_apis.py +0 -76
- tests/api/ils/test_closures.py +0 -324
- tests/api/ils/test_errors.py +0 -126
- tests/api/ils/test_facets.py +0 -84
- tests/api/ils/test_internal_locations.py +0 -96
- tests/api/ils/test_loaders.py +0 -55
- tests/api/ils/test_metadata_extensions.py +0 -205
- tests/api/ils/test_notifications.py +0 -183
- tests/api/ils/test_notifications_mails.py +0 -39
- tests/api/ils/test_notifications_permissions.py +0 -55
- tests/api/ils/test_patrons.py +0 -106
- tests/api/ils/test_record_delete.py +0 -46
- tests/api/ils/test_record_permissions.py +0 -135
- tests/api/ils/test_resolvers.py +0 -207
- tests/api/ils/test_stats.py +0 -160
- tests/api/ils/test_tasks.py +0 -211
- tests/api/ils/test_vocabularies.py +0 -35
- tests/conftest.py +0 -123
- tests/data/acq_orders.json +0 -89
- tests/data/acq_providers.json +0 -12
- tests/data/document_requests.json +0 -77
- tests/data/documents.json +0 -237
- tests/data/eitems.json +0 -66
- tests/data/ill_borrowing_requests.json +0 -77
- tests/data/ill_providers.json +0 -12
- tests/data/internal_locations.json +0 -22
- tests/data/items.json +0 -271
- tests/data/loans.json +0 -133
- tests/data/loans_most_loaned.json +0 -128
- tests/data/locations.json +0 -20
- tests/data/series.json +0 -33
- tests/helpers.py +0 -104
- tests/templates/notifications/title_body.html +0 -8
- tests/templates/notifications/title_body_html.html +0 -13
- tests/templates/notifications/title_body_html_ctx.html +0 -13
- tests/templates/notifications/title_only.html +0 -3
- tests/test_version.py +0 -17
- /tests/templates/notifications/blank.html → /invenio_app_ils/acquisition/mappings/os-v1/__init__.py +0 -0
- /invenio_app_ils/stats/aggregations/aggr_file_download/{v6 → os-v1}/__init__.py +0 -0
- /invenio_app_ils/stats/file_download/{v6 → os-v1}/__init__.py +0 -0
- {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info/licenses}/AUTHORS.rst +0 -0
- {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,678 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2020 CERN.
|
|
4
|
-
#
|
|
5
|
-
# invenio-app-ils is free software; you can redistribute it and/or modify it
|
|
6
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
-
|
|
8
|
-
"""Test records relations siblings."""
|
|
9
|
-
|
|
10
|
-
import json
|
|
11
|
-
|
|
12
|
-
from flask import url_for
|
|
13
|
-
|
|
14
|
-
from invenio_app_ils.documents.api import Document
|
|
15
|
-
from tests.helpers import get_test_record, user_login
|
|
16
|
-
|
|
17
|
-
from .helpers import (
|
|
18
|
-
recrel_assert_record_relations,
|
|
19
|
-
recrel_choose_endpoints_and_do_request,
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def _test_sibl_language_relation(client, json_headers):
|
|
24
|
-
"""Test creation/deletion siblings language relations."""
|
|
25
|
-
first_pid_value = "docid-1"
|
|
26
|
-
first_pid_type = "docid"
|
|
27
|
-
second_pid_value = "docid-2"
|
|
28
|
-
second_pid_type = "docid"
|
|
29
|
-
third_pid_value = "docid-6"
|
|
30
|
-
third_pid_type = "docid"
|
|
31
|
-
relation_type = "language"
|
|
32
|
-
|
|
33
|
-
payload = [
|
|
34
|
-
{
|
|
35
|
-
"pid_value": second_pid_value,
|
|
36
|
-
"pid_type": second_pid_type,
|
|
37
|
-
"relation_type": relation_type,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"pid_value": third_pid_value,
|
|
41
|
-
"pid_type": third_pid_type,
|
|
42
|
-
"relation_type": relation_type,
|
|
43
|
-
},
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
def _test_create():
|
|
47
|
-
"""Test relation creation."""
|
|
48
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
49
|
-
(client, json_headers, "POST"),
|
|
50
|
-
(
|
|
51
|
-
first_pid_value,
|
|
52
|
-
first_pid_type,
|
|
53
|
-
second_pid_value,
|
|
54
|
-
second_pid_type,
|
|
55
|
-
),
|
|
56
|
-
payload,
|
|
57
|
-
)
|
|
58
|
-
rec3 = Document.get_record_by_pid(third_pid_value)
|
|
59
|
-
rec3 = rec3.replace_refs()
|
|
60
|
-
recrel_assert_record_relations(
|
|
61
|
-
rec1,
|
|
62
|
-
expected={
|
|
63
|
-
"relations": {
|
|
64
|
-
"language": [
|
|
65
|
-
{
|
|
66
|
-
"pid_value": second_pid_value,
|
|
67
|
-
"pid_type": second_pid_type,
|
|
68
|
-
"relation_type": "language",
|
|
69
|
-
"record_metadata": {
|
|
70
|
-
"title": rec2["title"],
|
|
71
|
-
"languages": rec2["languages"],
|
|
72
|
-
"document_type": rec2["document_type"],
|
|
73
|
-
"publication_year": rec2["publication_year"],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"pid_value": third_pid_value,
|
|
78
|
-
"pid_type": third_pid_type,
|
|
79
|
-
"relation_type": "language",
|
|
80
|
-
"record_metadata": {
|
|
81
|
-
"title": rec3["title"],
|
|
82
|
-
"document_type": rec3["document_type"],
|
|
83
|
-
"languages": rec3["languages"],
|
|
84
|
-
"publication_year": rec3["publication_year"],
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
)
|
|
91
|
-
recrel_assert_record_relations(
|
|
92
|
-
rec2,
|
|
93
|
-
expected={
|
|
94
|
-
"relations": {
|
|
95
|
-
"language": [
|
|
96
|
-
{
|
|
97
|
-
"pid_value": first_pid_value,
|
|
98
|
-
"pid_type": first_pid_type,
|
|
99
|
-
"relation_type": "language",
|
|
100
|
-
"record_metadata": {
|
|
101
|
-
"title": rec1["title"],
|
|
102
|
-
"languages": rec1["languages"],
|
|
103
|
-
"edition": rec1["edition"],
|
|
104
|
-
"document_type": rec1["document_type"],
|
|
105
|
-
"publication_year": rec1["publication_year"],
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"pid_value": third_pid_value,
|
|
110
|
-
"pid_type": third_pid_type,
|
|
111
|
-
"relation_type": "language",
|
|
112
|
-
"record_metadata": {
|
|
113
|
-
"title": rec3["title"],
|
|
114
|
-
"languages": rec3["languages"],
|
|
115
|
-
"document_type": rec3["document_type"],
|
|
116
|
-
"publication_year": rec3["publication_year"],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
)
|
|
123
|
-
recrel_assert_record_relations(
|
|
124
|
-
rec3,
|
|
125
|
-
expected={
|
|
126
|
-
"relations": {
|
|
127
|
-
"language": [
|
|
128
|
-
{
|
|
129
|
-
"pid_value": first_pid_value,
|
|
130
|
-
"pid_type": first_pid_type,
|
|
131
|
-
"relation_type": "language",
|
|
132
|
-
"record_metadata": {
|
|
133
|
-
"title": rec1["title"],
|
|
134
|
-
"languages": rec1["languages"],
|
|
135
|
-
"edition": rec1["edition"],
|
|
136
|
-
"document_type": rec1["document_type"],
|
|
137
|
-
"publication_year": rec1["publication_year"],
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"pid_value": second_pid_value,
|
|
142
|
-
"pid_type": second_pid_type,
|
|
143
|
-
"relation_type": "language",
|
|
144
|
-
"record_metadata": {
|
|
145
|
-
"title": rec2["title"],
|
|
146
|
-
"languages": rec2["languages"],
|
|
147
|
-
"document_type": rec2["document_type"],
|
|
148
|
-
"publication_year": rec2["publication_year"],
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
def _test_delete():
|
|
157
|
-
"""Test relation creation."""
|
|
158
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
159
|
-
(client, json_headers, "DELETE"),
|
|
160
|
-
(
|
|
161
|
-
first_pid_value,
|
|
162
|
-
first_pid_type,
|
|
163
|
-
second_pid_value,
|
|
164
|
-
second_pid_type,
|
|
165
|
-
),
|
|
166
|
-
payload,
|
|
167
|
-
)
|
|
168
|
-
rec3 = Document.get_record_by_pid(third_pid_value)
|
|
169
|
-
rec3 = rec3.replace_refs()
|
|
170
|
-
recrel_assert_record_relations(rec1, expected={"relations": {}})
|
|
171
|
-
recrel_assert_record_relations(rec2, expected={"relations": {}})
|
|
172
|
-
recrel_assert_record_relations(rec3, expected={"relations": {}})
|
|
173
|
-
|
|
174
|
-
_test_create()
|
|
175
|
-
_test_delete()
|
|
176
|
-
# recreate for the next one, to have some more valuable test data
|
|
177
|
-
_test_create()
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
def _test_sibl_edition_relation(client, json_headers, testdata):
|
|
181
|
-
"""Test creation/deletion siblings edition relations."""
|
|
182
|
-
first_pid_value = "docid-3"
|
|
183
|
-
first_pid_type = "docid"
|
|
184
|
-
second_pid_value = "docid-1"
|
|
185
|
-
second_pid_type = "docid"
|
|
186
|
-
relation_type = "edition"
|
|
187
|
-
|
|
188
|
-
payload = {
|
|
189
|
-
"pid_value": second_pid_value,
|
|
190
|
-
"pid_type": second_pid_type,
|
|
191
|
-
"relation_type": relation_type,
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
def _test_create():
|
|
195
|
-
"""Test relation creation."""
|
|
196
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
197
|
-
(client, json_headers, "POST"),
|
|
198
|
-
(
|
|
199
|
-
first_pid_value,
|
|
200
|
-
first_pid_type,
|
|
201
|
-
second_pid_value,
|
|
202
|
-
second_pid_type,
|
|
203
|
-
),
|
|
204
|
-
payload,
|
|
205
|
-
)
|
|
206
|
-
recrel_assert_record_relations(
|
|
207
|
-
rec1,
|
|
208
|
-
expected={
|
|
209
|
-
"relations": {
|
|
210
|
-
"edition": [
|
|
211
|
-
{
|
|
212
|
-
"pid_value": second_pid_value,
|
|
213
|
-
"pid_type": second_pid_type,
|
|
214
|
-
"relation_type": "edition",
|
|
215
|
-
"record_metadata": {
|
|
216
|
-
"title": rec2["title"],
|
|
217
|
-
"edition": rec2["edition"],
|
|
218
|
-
"languages": rec2["languages"],
|
|
219
|
-
"document_type": rec2["document_type"],
|
|
220
|
-
"publication_year": rec2["publication_year"],
|
|
221
|
-
},
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
rec_docid_2 = get_test_record(testdata, "documents", "docid-2")
|
|
229
|
-
rec_docid_6 = get_test_record(testdata, "documents", "docid-6")
|
|
230
|
-
|
|
231
|
-
recrel_assert_record_relations(
|
|
232
|
-
rec2,
|
|
233
|
-
expected={
|
|
234
|
-
"relations": {
|
|
235
|
-
"edition": [
|
|
236
|
-
{
|
|
237
|
-
"pid_value": first_pid_value,
|
|
238
|
-
"pid_type": first_pid_type,
|
|
239
|
-
"relation_type": "edition",
|
|
240
|
-
"record_metadata": {
|
|
241
|
-
"title": rec1["title"],
|
|
242
|
-
"edition": rec1["edition"],
|
|
243
|
-
"document_type": rec1["document_type"],
|
|
244
|
-
"publication_year": rec1["publication_year"],
|
|
245
|
-
},
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
"language": [
|
|
249
|
-
{
|
|
250
|
-
"pid_value": rec_docid_2["pid"],
|
|
251
|
-
"pid_type": "docid",
|
|
252
|
-
"relation_type": "language",
|
|
253
|
-
"record_metadata": {
|
|
254
|
-
"title": rec_docid_2["title"],
|
|
255
|
-
"languages": rec_docid_2["languages"],
|
|
256
|
-
"document_type": rec_docid_2["document_type"],
|
|
257
|
-
"publication_year": rec_docid_2[
|
|
258
|
-
"publication_year"
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"pid_value": rec_docid_6["pid"],
|
|
264
|
-
"pid_type": "docid",
|
|
265
|
-
"relation_type": "language",
|
|
266
|
-
"record_metadata": {
|
|
267
|
-
"title": rec_docid_6["title"],
|
|
268
|
-
"document_type": rec_docid_6["document_type"],
|
|
269
|
-
"languages": rec_docid_6["languages"],
|
|
270
|
-
"publication_year": rec_docid_6[
|
|
271
|
-
"publication_year"
|
|
272
|
-
],
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
def _test_delete():
|
|
281
|
-
"""Test relation creation."""
|
|
282
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
283
|
-
(client, json_headers, "DELETE"),
|
|
284
|
-
(
|
|
285
|
-
first_pid_value,
|
|
286
|
-
first_pid_type,
|
|
287
|
-
second_pid_value,
|
|
288
|
-
second_pid_type,
|
|
289
|
-
),
|
|
290
|
-
payload,
|
|
291
|
-
)
|
|
292
|
-
recrel_assert_record_relations(rec1, expected={"relations": {}})
|
|
293
|
-
|
|
294
|
-
rec_docid_2 = get_test_record(testdata, "documents", "docid-2")
|
|
295
|
-
rec_docid_6 = get_test_record(testdata, "documents", "docid-6")
|
|
296
|
-
|
|
297
|
-
recrel_assert_record_relations(
|
|
298
|
-
rec2,
|
|
299
|
-
expected={
|
|
300
|
-
"relations": {
|
|
301
|
-
"language": [
|
|
302
|
-
{
|
|
303
|
-
"pid_value": rec_docid_2["pid"],
|
|
304
|
-
"pid_type": "docid",
|
|
305
|
-
"relation_type": "language",
|
|
306
|
-
"record_metadata": {
|
|
307
|
-
"title": rec_docid_2["title"],
|
|
308
|
-
"languages": rec_docid_2["languages"],
|
|
309
|
-
"document_type": rec_docid_2["document_type"],
|
|
310
|
-
"publication_year": rec_docid_2[
|
|
311
|
-
"publication_year"
|
|
312
|
-
],
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"pid_value": rec_docid_6["pid"],
|
|
317
|
-
"pid_type": "docid",
|
|
318
|
-
"relation_type": "language",
|
|
319
|
-
"record_metadata": {
|
|
320
|
-
"title": rec_docid_6["title"],
|
|
321
|
-
"document_type": rec_docid_6["document_type"],
|
|
322
|
-
"languages": rec_docid_6["languages"],
|
|
323
|
-
"publication_year": rec_docid_6[
|
|
324
|
-
"publication_year"
|
|
325
|
-
],
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
]
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
)
|
|
332
|
-
|
|
333
|
-
def _test_empty_edition_field():
|
|
334
|
-
edition_first_pid_value = "docid-11"
|
|
335
|
-
edition_first_pid_type = "docid"
|
|
336
|
-
edition_second_pid_value = "docid-12"
|
|
337
|
-
edition_second_pid_type = "docid"
|
|
338
|
-
|
|
339
|
-
create_payload = {
|
|
340
|
-
"pid_value": edition_second_pid_value,
|
|
341
|
-
"pid_type": edition_second_pid_type,
|
|
342
|
-
"relation_type": relation_type,
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
346
|
-
(client, json_headers, "POST"),
|
|
347
|
-
(
|
|
348
|
-
edition_first_pid_value,
|
|
349
|
-
edition_first_pid_type,
|
|
350
|
-
edition_second_pid_value,
|
|
351
|
-
edition_second_pid_type,
|
|
352
|
-
),
|
|
353
|
-
create_payload,
|
|
354
|
-
expect_status_code=400,
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
_test_create()
|
|
358
|
-
_test_delete()
|
|
359
|
-
# recreate for the next one, to have some more valuable test data
|
|
360
|
-
_test_create()
|
|
361
|
-
_test_empty_edition_field()
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
def _test_sibl_other_relation(client, json_headers, testdata):
|
|
365
|
-
"""Test creation/deletion siblings other relations."""
|
|
366
|
-
first_pid_value = "docid-2"
|
|
367
|
-
first_pid_type = "docid"
|
|
368
|
-
second_pid_value = "docid-3"
|
|
369
|
-
second_pid_type = "docid"
|
|
370
|
-
relation_type = "other"
|
|
371
|
-
|
|
372
|
-
payload = {
|
|
373
|
-
"pid_value": second_pid_value,
|
|
374
|
-
"pid_type": second_pid_type,
|
|
375
|
-
"relation_type": relation_type,
|
|
376
|
-
"note": "exercise",
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
def _test_create():
|
|
380
|
-
"""Test relation creation."""
|
|
381
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
382
|
-
(client, json_headers, "POST"),
|
|
383
|
-
(
|
|
384
|
-
first_pid_value,
|
|
385
|
-
first_pid_type,
|
|
386
|
-
second_pid_value,
|
|
387
|
-
second_pid_type,
|
|
388
|
-
),
|
|
389
|
-
payload,
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
rec_docid_1 = get_test_record(testdata, "documents", "docid-1")
|
|
393
|
-
rec_docid_6 = get_test_record(testdata, "documents", "docid-6")
|
|
394
|
-
|
|
395
|
-
recrel_assert_record_relations(
|
|
396
|
-
rec1,
|
|
397
|
-
expected={
|
|
398
|
-
"relations_extra_metadata": {
|
|
399
|
-
"other": [
|
|
400
|
-
{
|
|
401
|
-
"pid_value": second_pid_value,
|
|
402
|
-
"pid_type": second_pid_type,
|
|
403
|
-
"note": "exercise",
|
|
404
|
-
}
|
|
405
|
-
]
|
|
406
|
-
},
|
|
407
|
-
"relations": {
|
|
408
|
-
"language": [
|
|
409
|
-
{
|
|
410
|
-
"pid_value": rec_docid_1["pid"],
|
|
411
|
-
"pid_type": "docid",
|
|
412
|
-
"relation_type": "language",
|
|
413
|
-
"record_metadata": {
|
|
414
|
-
"title": rec_docid_1["title"],
|
|
415
|
-
"edition": rec_docid_1["edition"],
|
|
416
|
-
"languages": rec_docid_1["languages"],
|
|
417
|
-
"document_type": rec_docid_1["document_type"],
|
|
418
|
-
"publication_year": rec_docid_1[
|
|
419
|
-
"publication_year"
|
|
420
|
-
],
|
|
421
|
-
},
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
"pid_value": rec_docid_6["pid"],
|
|
425
|
-
"pid_type": "docid",
|
|
426
|
-
"relation_type": "language",
|
|
427
|
-
"record_metadata": {
|
|
428
|
-
"title": rec_docid_6["title"],
|
|
429
|
-
"document_type": rec_docid_6["document_type"],
|
|
430
|
-
"languages": rec_docid_6["languages"],
|
|
431
|
-
"publication_year": rec_docid_6[
|
|
432
|
-
"publication_year"
|
|
433
|
-
],
|
|
434
|
-
},
|
|
435
|
-
},
|
|
436
|
-
],
|
|
437
|
-
"other": [
|
|
438
|
-
{
|
|
439
|
-
"pid_value": second_pid_value,
|
|
440
|
-
"pid_type": second_pid_type,
|
|
441
|
-
"note": "exercise",
|
|
442
|
-
"relation_type": "other",
|
|
443
|
-
"record_metadata": {
|
|
444
|
-
"title": rec2["title"],
|
|
445
|
-
"edition": rec2["edition"],
|
|
446
|
-
"document_type": rec2["document_type"],
|
|
447
|
-
"publication_year": rec2["publication_year"],
|
|
448
|
-
},
|
|
449
|
-
}
|
|
450
|
-
],
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
)
|
|
454
|
-
recrel_assert_record_relations(
|
|
455
|
-
rec2,
|
|
456
|
-
expected={
|
|
457
|
-
"relations": {
|
|
458
|
-
"edition": [
|
|
459
|
-
{
|
|
460
|
-
"pid_value": rec_docid_1["pid"],
|
|
461
|
-
"pid_type": "docid",
|
|
462
|
-
"relation_type": "edition",
|
|
463
|
-
"record_metadata": {
|
|
464
|
-
"title": rec_docid_1["title"],
|
|
465
|
-
"edition": rec_docid_1["edition"],
|
|
466
|
-
"languages": rec_docid_1["languages"],
|
|
467
|
-
"document_type": rec_docid_1["document_type"],
|
|
468
|
-
"publication_year": rec_docid_1[
|
|
469
|
-
"publication_year"
|
|
470
|
-
],
|
|
471
|
-
},
|
|
472
|
-
}
|
|
473
|
-
],
|
|
474
|
-
"other": [
|
|
475
|
-
{
|
|
476
|
-
"pid_value": first_pid_value,
|
|
477
|
-
"pid_type": first_pid_type,
|
|
478
|
-
"note": "exercise",
|
|
479
|
-
"relation_type": "other",
|
|
480
|
-
"record_metadata": {
|
|
481
|
-
"title": rec1["title"],
|
|
482
|
-
"languages": rec1["languages"],
|
|
483
|
-
"document_type": rec1["document_type"],
|
|
484
|
-
"publication_year": rec1["publication_year"],
|
|
485
|
-
},
|
|
486
|
-
}
|
|
487
|
-
],
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
)
|
|
491
|
-
|
|
492
|
-
def _test_delete():
|
|
493
|
-
"""Test relation creation."""
|
|
494
|
-
rec1, rec2 = recrel_choose_endpoints_and_do_request(
|
|
495
|
-
(client, json_headers, "DELETE"),
|
|
496
|
-
(
|
|
497
|
-
first_pid_value,
|
|
498
|
-
first_pid_type,
|
|
499
|
-
second_pid_value,
|
|
500
|
-
second_pid_type,
|
|
501
|
-
),
|
|
502
|
-
payload,
|
|
503
|
-
)
|
|
504
|
-
|
|
505
|
-
rec_docid_1 = get_test_record(testdata, "documents", "docid-1")
|
|
506
|
-
rec_docid_6 = get_test_record(testdata, "documents", "docid-6")
|
|
507
|
-
|
|
508
|
-
recrel_assert_record_relations(
|
|
509
|
-
rec1,
|
|
510
|
-
expected={
|
|
511
|
-
"relations": {
|
|
512
|
-
"language": [
|
|
513
|
-
{
|
|
514
|
-
"pid_value": rec_docid_1["pid"],
|
|
515
|
-
"pid_type": "docid",
|
|
516
|
-
"relation_type": "language",
|
|
517
|
-
"record_metadata": {
|
|
518
|
-
"title": rec_docid_1["title"],
|
|
519
|
-
"edition": rec_docid_1["edition"],
|
|
520
|
-
"languages": rec_docid_1["languages"],
|
|
521
|
-
"document_type": rec_docid_1["document_type"],
|
|
522
|
-
"publication_year": rec_docid_1[
|
|
523
|
-
"publication_year"
|
|
524
|
-
],
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
"pid_value": rec_docid_6["pid"],
|
|
529
|
-
"pid_type": "docid",
|
|
530
|
-
"relation_type": "language",
|
|
531
|
-
"record_metadata": {
|
|
532
|
-
"title": rec_docid_6["title"],
|
|
533
|
-
"document_type": rec_docid_6["document_type"],
|
|
534
|
-
"languages": rec_docid_6["languages"],
|
|
535
|
-
"publication_year": rec_docid_6[
|
|
536
|
-
"publication_year"
|
|
537
|
-
],
|
|
538
|
-
},
|
|
539
|
-
},
|
|
540
|
-
]
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
)
|
|
544
|
-
recrel_assert_record_relations(
|
|
545
|
-
rec2,
|
|
546
|
-
expected={
|
|
547
|
-
"relations": {
|
|
548
|
-
"edition": [
|
|
549
|
-
{
|
|
550
|
-
"pid_value": rec_docid_1["pid"],
|
|
551
|
-
"pid_type": "docid",
|
|
552
|
-
"relation_type": "edition",
|
|
553
|
-
"record_metadata": {
|
|
554
|
-
"title": rec_docid_1["title"],
|
|
555
|
-
"edition": rec_docid_1["edition"],
|
|
556
|
-
"languages": rec_docid_1["languages"],
|
|
557
|
-
"document_type": rec_docid_1["document_type"],
|
|
558
|
-
"publication_year": rec_docid_1[
|
|
559
|
-
"publication_year"
|
|
560
|
-
],
|
|
561
|
-
},
|
|
562
|
-
}
|
|
563
|
-
]
|
|
564
|
-
}
|
|
565
|
-
},
|
|
566
|
-
)
|
|
567
|
-
|
|
568
|
-
_test_create()
|
|
569
|
-
_test_delete()
|
|
570
|
-
# recreate for the next one, to have some more valuable test data
|
|
571
|
-
_test_create()
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
def _test_sibl_invalid_relations_should_fail(
|
|
575
|
-
client, json_headers, invalids, status_code=400
|
|
576
|
-
):
|
|
577
|
-
"""Test relation creation with invalid siblings should fail."""
|
|
578
|
-
api_endpoint_documents = "invenio_app_ils_relations.docid_relations"
|
|
579
|
-
api_endpoint_series = "invenio_app_ils_relations.serid_relations"
|
|
580
|
-
|
|
581
|
-
for invalid in invalids:
|
|
582
|
-
first_pid_value = invalid["first_pid_value"]
|
|
583
|
-
first_pid_type = invalid["first_pid_type"]
|
|
584
|
-
second_pid_value = invalid["second_pid_value"]
|
|
585
|
-
second_pid_type = invalid["second_pid_type"]
|
|
586
|
-
relation_type = invalid["relation_type"]
|
|
587
|
-
|
|
588
|
-
api_endpoint = (
|
|
589
|
-
api_endpoint_documents
|
|
590
|
-
if first_pid_type == "docid"
|
|
591
|
-
else api_endpoint_series
|
|
592
|
-
)
|
|
593
|
-
|
|
594
|
-
url = url_for(api_endpoint, pid_value=first_pid_value)
|
|
595
|
-
payload = {
|
|
596
|
-
"pid_value": second_pid_value,
|
|
597
|
-
"pid_type": second_pid_type,
|
|
598
|
-
"relation_type": relation_type,
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
res = client.post(url, headers=json_headers, data=json.dumps(payload))
|
|
602
|
-
assert res.status_code == status_code
|
|
603
|
-
if status_code == 400:
|
|
604
|
-
error = json.loads(res.data.decode("utf-8"))
|
|
605
|
-
assert "message" in error
|
|
606
|
-
assert first_pid_value in error["message"]
|
|
607
|
-
assert second_pid_value in error["message"]
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
def test_siblings_relations(client, json_headers, testdata, users):
|
|
611
|
-
"""Test siblings relations."""
|
|
612
|
-
|
|
613
|
-
# only one test method to speed up tests and avoid testdata recreation at
|
|
614
|
-
# each test. As drawback, testdata is not cleaned between each test, so
|
|
615
|
-
# do not change the order of execution of the following tests :)
|
|
616
|
-
|
|
617
|
-
_test_sibl_invalid_relations_should_fail(
|
|
618
|
-
client,
|
|
619
|
-
json_headers,
|
|
620
|
-
[
|
|
621
|
-
{
|
|
622
|
-
"first_pid_value": "docid-1",
|
|
623
|
-
"first_pid_type": "docid",
|
|
624
|
-
"second_pid_value": "docid-2",
|
|
625
|
-
"second_pid_type": "docid",
|
|
626
|
-
"relation_type": "language",
|
|
627
|
-
}
|
|
628
|
-
],
|
|
629
|
-
status_code=401,
|
|
630
|
-
)
|
|
631
|
-
|
|
632
|
-
user_login(client, "librarian", users)
|
|
633
|
-
|
|
634
|
-
# docid-1 --language--> docid-2 and docid-6
|
|
635
|
-
_test_sibl_language_relation(client, json_headers)
|
|
636
|
-
|
|
637
|
-
# docid-3 --edition--> docid-1
|
|
638
|
-
_test_sibl_edition_relation(client, json_headers, testdata)
|
|
639
|
-
|
|
640
|
-
# docid-2 --other--> docid-3
|
|
641
|
-
_test_sibl_other_relation(client, json_headers, testdata)
|
|
642
|
-
|
|
643
|
-
# test wrong relations
|
|
644
|
-
invalids = [
|
|
645
|
-
# different pid type
|
|
646
|
-
{
|
|
647
|
-
"first_pid_value": "docid-1",
|
|
648
|
-
"first_pid_type": "docid",
|
|
649
|
-
"second_pid_value": "serid-1",
|
|
650
|
-
"second_pid_type": "serid",
|
|
651
|
-
"relation_type": "language",
|
|
652
|
-
},
|
|
653
|
-
# invalid edition: document with serial
|
|
654
|
-
{
|
|
655
|
-
"first_pid_value": "serid-3",
|
|
656
|
-
"first_pid_type": "serid",
|
|
657
|
-
"second_pid_value": "docid-5",
|
|
658
|
-
"second_pid_type": "docid",
|
|
659
|
-
"relation_type": "edition",
|
|
660
|
-
},
|
|
661
|
-
# different pid type
|
|
662
|
-
{
|
|
663
|
-
"first_pid_value": "serid-1",
|
|
664
|
-
"first_pid_type": "serid",
|
|
665
|
-
"second_pid_value": "docid-1",
|
|
666
|
-
"second_pid_type": "docid",
|
|
667
|
-
"relation_type": "other",
|
|
668
|
-
},
|
|
669
|
-
# same record
|
|
670
|
-
{
|
|
671
|
-
"first_pid_value": "docid-6",
|
|
672
|
-
"first_pid_type": "docid",
|
|
673
|
-
"second_pid_value": "docid-6",
|
|
674
|
-
"second_pid_type": "docid",
|
|
675
|
-
"relation_type": "language",
|
|
676
|
-
},
|
|
677
|
-
]
|
|
678
|
-
_test_sibl_invalid_relations_should_fail(client, json_headers, invalids)
|
tests/api/ils/series/__init__.py
DELETED