invenio-app-rdm 13.0.0b4.dev1__py2.py3-none-any.whl → 14.0.0b1.dev8__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_rdm/__init__.py +1 -1
- invenio_app_rdm/administration/moderation/__init__.py +11 -0
- invenio_app_rdm/administration/moderation/requests.py +175 -0
- invenio_app_rdm/administration/records/records.py +9 -7
- invenio_app_rdm/administration/templates/semantic-ui/invenio_app_rdm/administration/requests.html +14 -0
- invenio_app_rdm/administration/templates/semantic-ui/invenio_app_rdm/administration/requests_details.html +91 -0
- invenio_app_rdm/administration/user_moderation/user_moderation.py +4 -4
- invenio_app_rdm/administration/users/users.py +0 -5
- invenio_app_rdm/communities_ui/views/communities.py +9 -5
- invenio_app_rdm/config.py +73 -4
- invenio_app_rdm/ext.py +2 -2
- invenio_app_rdm/fixtures/pages.py +5 -2
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/deposit.html +11 -0
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html +2 -5
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/citation.html +2 -2
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/details.html +2 -2
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/communities.html +8 -7
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/external_resources.html +5 -6
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/licenses.html +9 -13
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/manage_menu.html +8 -5
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/stats.html +2 -4
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html +1 -1
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/doi.html +7 -5
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/files.html +21 -4
- invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/tombstone.html +6 -1
- invenio_app_rdm/records_ui/utils.py +93 -1
- invenio_app_rdm/records_ui/views/decorators.py +24 -14
- invenio_app_rdm/records_ui/views/deposits.py +100 -27
- invenio_app_rdm/records_ui/views/filters.py +11 -4
- invenio_app_rdm/records_ui/views/records.py +23 -13
- invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/file-modification/index.html +88 -0
- invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/guest-access-request/index.html +5 -5
- invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/record-deletion/index.html +95 -0
- invenio_app_rdm/requests_ui/views/requests.py +54 -87
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/auditLogs/ViewRecentChanges.js +8 -8
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUserForm.js +12 -17
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/RevisionsDiffViewer.js +14 -16
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/SetQuotaAction.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/records/api/routes.js +1 -2
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/requests/RequestsSearchResultItem.js +81 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/requests/RequestsSearchbarLayout.js +48 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/requests/index.js +22 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/communityRecordsSearch/CommunityRecordsSearchAppLayout.js +3 -4
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/CopyButton.js +38 -19
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/FileModificationUntil.js +45 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordDeletion/DeletionModal.js +354 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordDeletion/DeletionRadioGroup.js +44 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordDeletion.js +81 -0
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js +55 -5
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js +4 -1
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/CommunitiesManagement.js +2 -2
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ExportDropdown.js +7 -2
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ManageButton.js +52 -19
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RecordCitationField.js +15 -14
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RecordCommunitiesListModal/RecordCommunitiesListModal.js +4 -4
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RecordCommunitySubmission/RecordCommunitySubmissionModal.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RecordManagement.js +17 -3
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RecordVersionsList.js +16 -17
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/RemoveFromCommunity/RemoveFromCommunityAction.js +5 -5
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/index.js +42 -40
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/theme.js +9 -5
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/requests/timeline/AccessRequestTimelineEdit.js +5 -5
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/requests/timeline/AccessRequestTimelineRead.js +2 -2
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/search/components.js +14 -19
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js +9 -0
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/file_uploader/uppy.less +37 -0
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/landing_page/licenses.less +5 -3
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/globals/site.overrides +6 -1
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/modules/accordion.overrides +10 -1
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/modules/search.overrides +7 -0
- invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/modules/search.variables +0 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/i18next.js +1 -1
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/_generatedTranslations.js +66 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ar/messages.po +804 -137
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ar/translations.json +277 -249
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/bg/messages.po +689 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/bg/translations.json +102 -82
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ca/messages.po +699 -80
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ca/translations.json +112 -92
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/cs/messages.po +821 -138
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/cs/translations.json +290 -262
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/da/messages.po +691 -66
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/da/translations.json +91 -71
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/de/messages.po +818 -138
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/de/translations.json +260 -240
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/el/messages.po +698 -78
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/el/translations.json +108 -88
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/en/messages.po +1000 -5
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/en/translations.json +81 -28
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/es/messages.po +810 -137
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/es/translations.json +253 -233
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/et/messages.po +746 -133
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/et/translations.json +130 -110
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fa/messages.po +688 -69
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fa/translations.json +103 -79
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fr/messages.po +809 -126
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/fr/translations.json +277 -257
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hr/messages.po +695 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hr/translations.json +101 -79
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hu/messages.po +801 -135
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/hu/translations.json +254 -234
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/index.js +16 -65
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/it/messages.po +712 -86
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/it/translations.json +116 -96
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ja/messages.po +683 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ja/translations.json +96 -78
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ka/messages.po +689 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ka/translations.json +109 -85
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ko/messages.po +889 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ko/translations.json +277 -0
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/lt/messages.po +702 -71
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/lt/translations.json +113 -85
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/no/messages.po +689 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/no/translations.json +102 -82
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pl/messages.po +704 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pl/translations.json +119 -91
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pt/messages.po +694 -69
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/pt/translations.json +93 -73
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ro/messages.po +717 -85
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ro/translations.json +155 -133
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ru/messages.po +806 -124
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/ru/translations.json +288 -260
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sk/messages.po +713 -82
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sk/translations.json +119 -91
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sv/messages.po +807 -141
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/sv/translations.json +260 -240
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/tr/messages.po +799 -128
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/tr/translations.json +259 -239
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/uk/messages.po +756 -131
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/uk/translations.json +124 -96
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_CN/messages.po +736 -123
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_CN/translations.json +130 -108
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_TW/messages.po +683 -70
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_TW/translations.json +100 -78
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/package.json +3 -37
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/translations.pot +243 -94
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/search.de.html +2 -2
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/search.en.html +4 -4
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/search.sv.html +4 -4
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/intro_section.html +7 -6
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/macros/records_list.html +2 -1
- invenio_app_rdm/theme/templates/semantic-ui/invenio_communities/default_static_page.html +26 -0
- invenio_app_rdm/theme/webpack.py +3 -2
- invenio_app_rdm/translations/ar/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ar/LC_MESSAGES/messages.po +972 -376
- invenio_app_rdm/translations/bg/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/bg/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/ca/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ca/LC_MESSAGES/messages.po +912 -283
- invenio_app_rdm/translations/cs/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/cs/LC_MESSAGES/messages.po +1069 -405
- invenio_app_rdm/translations/da/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/da/LC_MESSAGES/messages.po +908 -273
- invenio_app_rdm/translations/de/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/de/LC_MESSAGES/messages.po +1017 -406
- invenio_app_rdm/translations/el/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/el/LC_MESSAGES/messages.po +915 -286
- invenio_app_rdm/translations/es/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/es/LC_MESSAGES/messages.po +963 -371
- invenio_app_rdm/translations/et/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/et/LC_MESSAGES/messages.po +938 -362
- invenio_app_rdm/translations/fa/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/fa/LC_MESSAGES/messages.po +906 -277
- invenio_app_rdm/translations/fr/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/fr/LC_MESSAGES/messages.po +1032 -375
- invenio_app_rdm/translations/hr/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/hr/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/hu/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/hu/LC_MESSAGES/messages.po +985 -369
- invenio_app_rdm/translations/it/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/it/LC_MESSAGES/messages.po +928 -298
- invenio_app_rdm/translations/ja/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ja/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/ka/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ka/LC_MESSAGES/messages.po +909 -280
- invenio_app_rdm/translations/ko/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ko/LC_MESSAGES/messages.po +1361 -0
- invenio_app_rdm/translations/lt/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/lt/LC_MESSAGES/messages.po +910 -281
- invenio_app_rdm/translations/messages.pot +486 -303
- invenio_app_rdm/translations/no/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/no/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/pl/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/pl/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/translations/pt/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/pt/LC_MESSAGES/messages.po +906 -277
- invenio_app_rdm/translations/ro/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ro/LC_MESSAGES/messages.po +1042 -384
- invenio_app_rdm/translations/ru/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/ru/LC_MESSAGES/messages.po +1022 -370
- invenio_app_rdm/translations/sk/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/sk/LC_MESSAGES/messages.po +916 -287
- invenio_app_rdm/translations/sv/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/sv/LC_MESSAGES/messages.po +989 -380
- invenio_app_rdm/translations/tr/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/tr/LC_MESSAGES/messages.po +992 -341
- invenio_app_rdm/translations/uk/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/uk/LC_MESSAGES/messages.po +935 -356
- invenio_app_rdm/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/zh_CN/LC_MESSAGES/messages.po +939 -347
- invenio_app_rdm/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
- invenio_app_rdm/translations/zh_TW/LC_MESSAGES/messages.po +907 -278
- invenio_app_rdm/upgrade_scripts/migrate_12_0_to_13_0.py +190 -62
- {invenio_app_rdm-13.0.0b4.dev1.dist-info → invenio_app_rdm-14.0.0b1.dev8.dist-info}/METADATA +118 -7
- {invenio_app_rdm-13.0.0b4.dev1.dist-info → invenio_app_rdm-14.0.0b1.dev8.dist-info}/RECORD +209 -225
- {invenio_app_rdm-13.0.0b4.dev1.dist-info → invenio_app_rdm-14.0.0b1.dev8.dist-info}/entry_points.txt +2 -0
- {invenio_app_rdm-13.0.0b4.dev1.dist-info → invenio_app_rdm-14.0.0b1.dev8.dist-info}/top_level.txt +0 -1
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/i18next-scanner.config.js +0 -64
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/package-lock.json +0 -1512
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/compileCatalog.js +0 -40
- invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/initCatalog.js +0 -20
- tests/__init__.py +0 -8
- tests/api/__init__.py +0 -8
- tests/api/conftest.py +0 -24
- tests/api/test_protect_files_rest.py +0 -73
- tests/api/test_record_api.py +0 -175
- tests/api/test_stats_api.py +0 -26
- tests/conftest.py +0 -390
- tests/fixtures/__init__.py +0 -8
- tests/fixtures/app_data/oai_sets.yaml +0 -3
- tests/fixtures/app_data/pages/about.html +0 -1
- tests/fixtures/app_data/pages.yaml +0 -4
- tests/fixtures/conftest.py +0 -27
- tests/fixtures/test_cli.py +0 -25
- tests/fixtures/test_fixtures.py +0 -46
- tests/mock_module/__init__.py +0 -7
- tests/mock_module/templates/mock_mail.html +0 -27
- tests/mock_module/views.py +0 -32
- tests/redirector/__init__.py +0 -8
- tests/redirector/conftest.py +0 -54
- tests/redirector/test_redirector.py +0 -28
- tests/test_tasks.py +0 -209
- tests/test_utils.py +0 -67
- tests/test_version.py +0 -16
- tests/test_views.py +0 -43
- tests/ui/__init__.py +0 -8
- tests/ui/conftest.py +0 -115
- tests/ui/test_deposits.py +0 -115
- tests/ui/test_export_formats.py +0 -37
- tests/ui/test_file_download.py +0 -73
- tests/ui/test_filters.py +0 -10
- tests/ui/test_robotstxt.py +0 -35
- tests/ui/test_signposting_ui.py +0 -95
- tests/ui/test_sitemaps.py +0 -85
- tests/ui/test_stats_ui.py +0 -92
- {invenio_app_rdm-13.0.0b4.dev1.dist-info → invenio_app_rdm-14.0.0b1.dev8.dist-info}/WHEEL +0 -0
- {invenio_app_rdm-13.0.0b4.dev1.dist-info → invenio_app_rdm-14.0.0b1.dev8.dist-info}/licenses/LICENSE +0 -0
tests/test_tasks.py
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2022-2024 CERN.
|
|
4
|
-
# Copyright (C) 2025 Northwestern University.
|
|
5
|
-
#
|
|
6
|
-
# Invenio App RDM is free software; you can redistribute it and/or modify it
|
|
7
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
8
|
-
"""Test invenio-app-rdm celery tasks."""
|
|
9
|
-
|
|
10
|
-
from io import BytesIO
|
|
11
|
-
|
|
12
|
-
import pytest
|
|
13
|
-
from invenio_access.permissions import system_identity
|
|
14
|
-
from invenio_db import db
|
|
15
|
-
from invenio_files_rest.models import Bucket, FileInstance, Location, ObjectVersion
|
|
16
|
-
from invenio_rdm_records.proxies import current_rdm_records
|
|
17
|
-
|
|
18
|
-
from invenio_app_rdm.tasks import file_integrity_report
|
|
19
|
-
|
|
20
|
-
# Fixtures
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@pytest.fixture
|
|
24
|
-
def draft_with_file_instance(running_app, minimal_record):
|
|
25
|
-
"""Create draft with file and return (Draft, FileInstance)."""
|
|
26
|
-
minimal_record["files"] = {"enabled": True}
|
|
27
|
-
|
|
28
|
-
record_service = current_rdm_records.records_service
|
|
29
|
-
file_service = record_service.draft_files
|
|
30
|
-
|
|
31
|
-
draft = record_service.create(system_identity, minimal_record)
|
|
32
|
-
file_to_initialise = [
|
|
33
|
-
{
|
|
34
|
-
"key": "article.txt",
|
|
35
|
-
"checksum": "md5:c785060c866796cc2a1708c997154c8e",
|
|
36
|
-
"size": 17, # 2kB
|
|
37
|
-
"metadata": {
|
|
38
|
-
"description": "Published article PDF.",
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
file_service.init_files(system_identity, draft.id, file_to_initialise)
|
|
43
|
-
content = BytesIO(b"test file content")
|
|
44
|
-
file_service.set_file_content(
|
|
45
|
-
system_identity,
|
|
46
|
-
draft.id,
|
|
47
|
-
file_to_initialise[0]["key"],
|
|
48
|
-
content,
|
|
49
|
-
content.getbuffer().nbytes,
|
|
50
|
-
)
|
|
51
|
-
file_item = file_service.commit_file(system_identity, draft.id, "article.txt")
|
|
52
|
-
# fmt: off
|
|
53
|
-
id_of_file_instance = (
|
|
54
|
-
file_item
|
|
55
|
-
._record
|
|
56
|
-
.files
|
|
57
|
-
.entries["article.txt"]
|
|
58
|
-
.object_version.file_id
|
|
59
|
-
)
|
|
60
|
-
# fmt: on
|
|
61
|
-
f = FileInstance.query.get(id_of_file_instance)
|
|
62
|
-
return draft, f
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@pytest.fixture
|
|
66
|
-
def draft_with_invalid_file_instance(draft_with_file_instance):
|
|
67
|
-
# Force an invalid checksum
|
|
68
|
-
draft, f = draft_with_file_instance
|
|
69
|
-
f.checksum = "invalid"
|
|
70
|
-
f.verify_checksum()
|
|
71
|
-
db.session.commit()
|
|
72
|
-
|
|
73
|
-
# Retrieve the file instance (with updated last_check)
|
|
74
|
-
f = FileInstance.query.get(f.id)
|
|
75
|
-
|
|
76
|
-
return draft, f
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@pytest.fixture
|
|
80
|
-
def record_with_invalid_file_instance(draft_with_invalid_file_instance):
|
|
81
|
-
draft, f = draft_with_invalid_file_instance
|
|
82
|
-
record_service = current_rdm_records.records_service
|
|
83
|
-
return record_service.publish(system_identity, draft.id), f
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@pytest.fixture
|
|
87
|
-
def invalid_file_instance(record_with_invalid_file_instance):
|
|
88
|
-
draft, f = record_with_invalid_file_instance
|
|
89
|
-
return f
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# Tests
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def test_task_file_integrity_report(
|
|
96
|
-
app, record_with_invalid_file_instance, set_app_config_fn_scoped
|
|
97
|
-
):
|
|
98
|
-
"""Test celery task for file integrity reports."""
|
|
99
|
-
record, invalid_file_instance = record_with_invalid_file_instance
|
|
100
|
-
assert invalid_file_instance.last_check is False
|
|
101
|
-
|
|
102
|
-
# A report must be generated for the file
|
|
103
|
-
mail = app.extensions.get("mail")
|
|
104
|
-
assert mail
|
|
105
|
-
|
|
106
|
-
recipients = "test@invenio.org"
|
|
107
|
-
sender = "test@invenio.org"
|
|
108
|
-
|
|
109
|
-
uri = invalid_file_instance.uri
|
|
110
|
-
file_id = invalid_file_instance.id
|
|
111
|
-
file_name = invalid_file_instance.objects[0].key
|
|
112
|
-
checksum = invalid_file_instance.checksum
|
|
113
|
-
|
|
114
|
-
with mail.record_messages() as outbox:
|
|
115
|
-
# Configure email and validate that email was sent
|
|
116
|
-
set_app_config_fn_scoped(
|
|
117
|
-
{
|
|
118
|
-
"APP_RDM_FILES_INTEGRITY_REPORT_TEMPLATE": "mock_mail.html",
|
|
119
|
-
"APP_RDM_ADMIN_EMAIL_RECIPIENT": recipients,
|
|
120
|
-
"MAIL_DEFAULT_SENDER": sender,
|
|
121
|
-
}
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
file_integrity_report()
|
|
125
|
-
assert len(outbox) == 1
|
|
126
|
-
mail_sent = outbox[0]
|
|
127
|
-
assert mail_sent.recipients == [recipients]
|
|
128
|
-
assert mail_sent.sender == sender
|
|
129
|
-
assert "Checksum: {}".format(checksum) in mail_sent.body
|
|
130
|
-
assert "URI: {}".format(uri) in mail_sent.body
|
|
131
|
-
assert "ID: {}".format(str(file_id)) in mail_sent.body
|
|
132
|
-
assert "Name: {}".format(file_name) in mail_sent.body
|
|
133
|
-
assert f"Record: https://127.0.0.1:5000/records/{record.id}" in mail_sent.body
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
def test_integrity_report_invalid_template(
|
|
137
|
-
app, invalid_file_instance, set_app_config_fn_scoped
|
|
138
|
-
):
|
|
139
|
-
"""Test non-existant e-mail template."""
|
|
140
|
-
assert invalid_file_instance.last_check is False
|
|
141
|
-
|
|
142
|
-
mail = app.extensions.get("mail")
|
|
143
|
-
assert mail
|
|
144
|
-
|
|
145
|
-
with mail.record_messages() as outbox:
|
|
146
|
-
# Remove the template, no e-mail is sent
|
|
147
|
-
set_app_config_fn_scoped({"APP_RDM_FILES_INTEGRITY_REPORT_TEMPLATE": None})
|
|
148
|
-
|
|
149
|
-
file_integrity_report()
|
|
150
|
-
assert len(outbox) == 0
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def test_integrity_report_invalid_addresses(
|
|
154
|
-
app, invalid_file_instance, set_app_config_fn_scoped
|
|
155
|
-
):
|
|
156
|
-
"""Test invalid recipient address."""
|
|
157
|
-
assert invalid_file_instance.last_check is False
|
|
158
|
-
|
|
159
|
-
mail = app.extensions.get("mail")
|
|
160
|
-
assert mail
|
|
161
|
-
|
|
162
|
-
with mail.record_messages() as outbox:
|
|
163
|
-
set_app_config_fn_scoped(
|
|
164
|
-
{
|
|
165
|
-
# Use mock template
|
|
166
|
-
"APP_RDM_FILES_INTEGRITY_REPORT_TEMPLATE": "mock_mail.html",
|
|
167
|
-
# Recipient is not set, mail is not sent.
|
|
168
|
-
"APP_RDM_ADMIN_EMAIL_RECIPIENT": None,
|
|
169
|
-
}
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
file_integrity_report()
|
|
173
|
-
assert len(outbox) == 0
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
def test_integrity_report_default_template(
|
|
177
|
-
app, draft_with_invalid_file_instance, set_app_config_fn_scoped
|
|
178
|
-
):
|
|
179
|
-
"""Test invalid recipient address."""
|
|
180
|
-
draft, invalid_file_instance = draft_with_invalid_file_instance
|
|
181
|
-
assert invalid_file_instance.last_check is False
|
|
182
|
-
|
|
183
|
-
mail = app.extensions.get("mail")
|
|
184
|
-
assert mail
|
|
185
|
-
|
|
186
|
-
recipients = "test@invenio.org"
|
|
187
|
-
sender = "test@invenio.org"
|
|
188
|
-
|
|
189
|
-
uri = invalid_file_instance.uri
|
|
190
|
-
file_id = invalid_file_instance.id
|
|
191
|
-
file_name = invalid_file_instance.objects[0].key
|
|
192
|
-
checksum = invalid_file_instance.checksum
|
|
193
|
-
|
|
194
|
-
with mail.record_messages() as outbox:
|
|
195
|
-
# Use default template
|
|
196
|
-
set_app_config_fn_scoped(
|
|
197
|
-
{"APP_RDM_ADMIN_EMAIL_RECIPIENT": recipients, "MAIL_DEFAULT_SENDER": sender}
|
|
198
|
-
)
|
|
199
|
-
|
|
200
|
-
file_integrity_report()
|
|
201
|
-
assert len(outbox) == 1
|
|
202
|
-
mail_sent = outbox[0]
|
|
203
|
-
assert mail_sent.recipients == [recipients]
|
|
204
|
-
assert mail_sent.sender == sender
|
|
205
|
-
assert "Checksum: {}".format(checksum) in mail_sent.body
|
|
206
|
-
assert "URI: {}".format(uri) in mail_sent.body
|
|
207
|
-
assert "ID: {}".format(str(file_id)) in mail_sent.body
|
|
208
|
-
assert "Name: {}".format(file_name) in mail_sent.body
|
|
209
|
-
assert f"Draft: https://127.0.0.1:5000/uploads/{draft.id}" in mail_sent.body
|
tests/test_utils.py
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2021 TU Wien.
|
|
4
|
-
#
|
|
5
|
-
# Invenio App RDM 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
|
-
"""Tests for utility functions."""
|
|
9
|
-
|
|
10
|
-
from datetime import datetime
|
|
11
|
-
|
|
12
|
-
from invenio_app_rdm.records_ui.utils import set_default_value
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def test_set_default_value__value():
|
|
16
|
-
"""Test setting a value."""
|
|
17
|
-
dict_ = {"metadata": {"publication_date": None}}
|
|
18
|
-
value = "1939-01-01"
|
|
19
|
-
path = "publication_date"
|
|
20
|
-
|
|
21
|
-
set_default_value(dict_, value, path)
|
|
22
|
-
|
|
23
|
-
assert dict_["metadata"]["publication_date"] == value
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def test_set_default_value__callable():
|
|
27
|
-
"""Test setting a value via a callable."""
|
|
28
|
-
dict_ = {"metadata": {"publication_date": None}}
|
|
29
|
-
|
|
30
|
-
def func():
|
|
31
|
-
return datetime.now().strftime("%Y-%m-%d")
|
|
32
|
-
|
|
33
|
-
path = "publication_date"
|
|
34
|
-
today = func()
|
|
35
|
-
|
|
36
|
-
set_default_value(dict_, func, path)
|
|
37
|
-
|
|
38
|
-
assert dict_["metadata"]["publication_date"] == today
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def test_set_default_value__no_path_prefix():
|
|
42
|
-
"""Test setting a value for an unprefixed path."""
|
|
43
|
-
dict_ = {"metadata": {"publication_date": None}}
|
|
44
|
-
value = "1939-01-01"
|
|
45
|
-
path = ".publication_date"
|
|
46
|
-
|
|
47
|
-
set_default_value(dict_, value, path)
|
|
48
|
-
|
|
49
|
-
assert dict_["metadata"]["publication_date"] is None
|
|
50
|
-
assert dict_["publication_date"] == value
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def test_set_default_value__explicit_and_automatic_prefix():
|
|
54
|
-
"""Compare values set with auto-prefix and explicit prefix."""
|
|
55
|
-
dict1 = {"metadata": {"publication_date": None}}
|
|
56
|
-
dict2 = dict1.copy()
|
|
57
|
-
value = "1939-01-01"
|
|
58
|
-
path1 = "publication_date"
|
|
59
|
-
path2 = ".metadata.publication_date"
|
|
60
|
-
|
|
61
|
-
set_default_value(dict1, value, path1)
|
|
62
|
-
set_default_value(dict2, value, path2)
|
|
63
|
-
|
|
64
|
-
assert (
|
|
65
|
-
dict1["metadata"]["publication_date"] == dict2["metadata"]["publication_date"]
|
|
66
|
-
)
|
|
67
|
-
assert dict1["metadata"]["publication_date"] == value
|
tests/test_version.py
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2019 CERN.
|
|
4
|
-
# Copyright (C) 2019 Northwestern University.
|
|
5
|
-
#
|
|
6
|
-
# Invenio App RDM is free software; you can redistribute it and/or modify it
|
|
7
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
8
|
-
|
|
9
|
-
"""Simple test of version import."""
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_version():
|
|
13
|
-
"""Test version import."""
|
|
14
|
-
from invenio_app_rdm import __version__
|
|
15
|
-
|
|
16
|
-
assert __version__
|
tests/test_views.py
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2024 CERN.
|
|
4
|
-
# Copyright (C) 2024 KTH Royal Institute of Technology.
|
|
5
|
-
#
|
|
6
|
-
# Invenio-RDM is free software; you can redistribute it and/or modify
|
|
7
|
-
# it under the terms of the MIT License; see LICENSE file for more details.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
from unittest.mock import Mock, patch
|
|
11
|
-
|
|
12
|
-
import pytest
|
|
13
|
-
|
|
14
|
-
from invenio_app_rdm.theme.views import add_static_page_routes
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_add_static_page_routes():
|
|
18
|
-
"""Test add_static_page_routes function."""
|
|
19
|
-
|
|
20
|
-
# Mocking the blueprint and app objects
|
|
21
|
-
mock_blueprint = Mock()
|
|
22
|
-
mock_app = Mock()
|
|
23
|
-
mock_app.config = {"APP_RDM_PAGES": {"endpoint1": "/path1", "endpoint2": "/path2"}}
|
|
24
|
-
|
|
25
|
-
# Mocking the create_page_view function
|
|
26
|
-
with patch("invenio_app_rdm.theme.views.create_page_view") as mock_create_page_view:
|
|
27
|
-
mock_create_page_view.side_effect = lambda x: f"view_func_{x}"
|
|
28
|
-
|
|
29
|
-
add_static_page_routes(mock_blueprint, mock_app)
|
|
30
|
-
|
|
31
|
-
mock_blueprint.add_url_rule.assert_any_call(
|
|
32
|
-
"/path1", endpoint="endpoint1", view_func="view_func_/path1"
|
|
33
|
-
)
|
|
34
|
-
mock_blueprint.add_url_rule.assert_any_call(
|
|
35
|
-
"/path2", endpoint="endpoint2", view_func="view_func_/path2"
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
# Check if was called with the right arguments
|
|
39
|
-
mock_create_page_view.assert_any_call("/path1")
|
|
40
|
-
mock_create_page_view.assert_any_call("/path2")
|
|
41
|
-
|
|
42
|
-
# Check if was called the right number of times
|
|
43
|
-
assert mock_blueprint.add_url_rule.call_count == 2
|
tests/ui/__init__.py
DELETED
tests/ui/conftest.py
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2019 CERN.
|
|
4
|
-
# Copyright (C) 2019 Northwestern University.
|
|
5
|
-
# Copyright (C) 2024 Graz University of Technology.
|
|
6
|
-
#
|
|
7
|
-
# Invenio App RDM is free software; you can redistribute it and/or modify it
|
|
8
|
-
# under the terms of the MIT License; see LICENSE file for more details.
|
|
9
|
-
|
|
10
|
-
"""Pytest fixtures and plugins for the UI application."""
|
|
11
|
-
|
|
12
|
-
from io import BytesIO
|
|
13
|
-
|
|
14
|
-
import pytest
|
|
15
|
-
from flask_principal import Identity
|
|
16
|
-
from flask_webpackext.manifest import (
|
|
17
|
-
JinjaManifest,
|
|
18
|
-
JinjaManifestEntry,
|
|
19
|
-
JinjaManifestLoader,
|
|
20
|
-
)
|
|
21
|
-
from invenio_access.permissions import any_user, authenticated_user, system_identity
|
|
22
|
-
from invenio_app.factory import create_ui
|
|
23
|
-
from invenio_rdm_records.proxies import current_rdm_records_service
|
|
24
|
-
from invenio_search import current_search
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
# Mock the webpack manifest to avoid having to compile the full assets.
|
|
29
|
-
#
|
|
30
|
-
class MockJinjaManifest(JinjaManifest):
|
|
31
|
-
"""Mock manifest."""
|
|
32
|
-
|
|
33
|
-
def __getitem__(self, key):
|
|
34
|
-
"""Get a manifest entry."""
|
|
35
|
-
return JinjaManifestEntry(key, [key])
|
|
36
|
-
|
|
37
|
-
def __getattr__(self, name):
|
|
38
|
-
"""Get a manifest entry."""
|
|
39
|
-
return JinjaManifestEntry(name, [name])
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class MockManifestLoader(JinjaManifestLoader):
|
|
43
|
-
"""Manifest loader creating a mocked manifest."""
|
|
44
|
-
|
|
45
|
-
def load(self, filepath):
|
|
46
|
-
"""Load the manifest."""
|
|
47
|
-
return MockJinjaManifest()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@pytest.fixture(scope="module")
|
|
51
|
-
def app_config(app_config):
|
|
52
|
-
"""Create test app."""
|
|
53
|
-
app_config["WEBPACKEXT_MANIFEST_LOADER"] = MockManifestLoader
|
|
54
|
-
return app_config
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@pytest.fixture(scope="module")
|
|
58
|
-
def create_app():
|
|
59
|
-
"""Create test app."""
|
|
60
|
-
return create_ui
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@pytest.fixture()
|
|
64
|
-
def index_templates(running_app):
|
|
65
|
-
"""Ensure the index templates are in place."""
|
|
66
|
-
list(current_search.put_templates(ignore=[400]))
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@pytest.fixture()
|
|
70
|
-
def record(running_app, minimal_record, create_record):
|
|
71
|
-
"""Create and publish a record."""
|
|
72
|
-
return create_record(data=minimal_record)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
@pytest.fixture()
|
|
76
|
-
def draft_with_file(running_app, minimal_record, users):
|
|
77
|
-
"""Create a draft with a file."""
|
|
78
|
-
minimal_record["files"] = {"enabled": True}
|
|
79
|
-
|
|
80
|
-
# Use a user's identity to make sure the record has an owner
|
|
81
|
-
user_identity = Identity(users["user1"].id)
|
|
82
|
-
user_identity.provides.add(any_user)
|
|
83
|
-
user_identity.provides.add(authenticated_user)
|
|
84
|
-
record_service = current_rdm_records_service
|
|
85
|
-
file_service = record_service.draft_files
|
|
86
|
-
|
|
87
|
-
draft = record_service.create(user_identity, minimal_record)
|
|
88
|
-
file_to_initialise = [
|
|
89
|
-
{
|
|
90
|
-
"key": "article.txt",
|
|
91
|
-
"checksum": "md5:c785060c866796cc2a1708c997154c8e",
|
|
92
|
-
"size": 17, # 2kB
|
|
93
|
-
"metadata": {
|
|
94
|
-
"description": "Published article PDF.",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
]
|
|
98
|
-
file_service.init_files(system_identity, draft.id, file_to_initialise)
|
|
99
|
-
content = BytesIO(b"test file content")
|
|
100
|
-
file_service.set_file_content(
|
|
101
|
-
system_identity,
|
|
102
|
-
draft.id,
|
|
103
|
-
file_to_initialise[0]["key"],
|
|
104
|
-
content,
|
|
105
|
-
content.getbuffer().nbytes,
|
|
106
|
-
)
|
|
107
|
-
file_service.commit_file(system_identity, draft.id, "article.txt")
|
|
108
|
-
return draft
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@pytest.fixture()
|
|
112
|
-
def record_with_file(draft_with_file):
|
|
113
|
-
"""Create and publish a record with file."""
|
|
114
|
-
record_service = current_rdm_records_service
|
|
115
|
-
return record_service.publish(system_identity, draft_with_file.id)
|
tests/ui/test_deposits.py
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2021 Northwestern University.
|
|
4
|
-
#
|
|
5
|
-
# Invenio-App-RDM is free software; you can redistribute it and/or modify
|
|
6
|
-
# it under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
-
|
|
8
|
-
"""Test deposit views."""
|
|
9
|
-
|
|
10
|
-
import pytest
|
|
11
|
-
from invenio_access.permissions import system_identity
|
|
12
|
-
from invenio_search.engine import dsl
|
|
13
|
-
from invenio_vocabularies.proxies import current_service as vocabulary_service
|
|
14
|
-
from invenio_vocabularies.records.api import Vocabulary
|
|
15
|
-
|
|
16
|
-
from invenio_app_rdm.records_ui.views.deposits import VocabulariesOptions
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@pytest.fixture()
|
|
20
|
-
def additional_resource_types(running_app):
|
|
21
|
-
"""Resource type vocabulary record."""
|
|
22
|
-
vocabulary_service.create(
|
|
23
|
-
system_identity,
|
|
24
|
-
{
|
|
25
|
-
"id": "publication",
|
|
26
|
-
"icon": "file alternate",
|
|
27
|
-
"props": {
|
|
28
|
-
"csl": "report",
|
|
29
|
-
"datacite_general": "Text",
|
|
30
|
-
"datacite_type": "",
|
|
31
|
-
"eurepo": "info:eu-repo/semantics/other",
|
|
32
|
-
"openaire_resourceType": "17",
|
|
33
|
-
"openaire_type": "publication",
|
|
34
|
-
"schema.org": "https://schema.org/CreativeWork",
|
|
35
|
-
"subtype": "",
|
|
36
|
-
"type": "publication",
|
|
37
|
-
},
|
|
38
|
-
"title": {"en": "Publication"},
|
|
39
|
-
"tags": ["depositable", "linkable"],
|
|
40
|
-
"type": "resourcetypes",
|
|
41
|
-
},
|
|
42
|
-
)
|
|
43
|
-
vocabulary_service.create(
|
|
44
|
-
system_identity,
|
|
45
|
-
{
|
|
46
|
-
"id": "publication-annotationcollection",
|
|
47
|
-
"icon": "file alternate",
|
|
48
|
-
"props": {
|
|
49
|
-
"csl": "report",
|
|
50
|
-
"datacite_general": "Collection",
|
|
51
|
-
"datacite_type": "",
|
|
52
|
-
"eurepo": "info:eu-repo/semantics/technicalDocumentation",
|
|
53
|
-
"openaire_resourceType": "9",
|
|
54
|
-
"openaire_type": "publication",
|
|
55
|
-
"schema.org": "https://schema.org/Collection",
|
|
56
|
-
"subtype": "publication-annotationcollection",
|
|
57
|
-
"type": "publication",
|
|
58
|
-
},
|
|
59
|
-
"title": {"en": "Annotation collection"},
|
|
60
|
-
"tags": ["depositable", "linkable"],
|
|
61
|
-
"type": "resourcetypes",
|
|
62
|
-
},
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
Vocabulary.index.refresh()
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def test_resource_types(app, client_with_login, additional_resource_types):
|
|
69
|
-
options = VocabulariesOptions()
|
|
70
|
-
expected = [
|
|
71
|
-
# If no corresponding parent type entry (e.g. image-photo), type_name
|
|
72
|
-
# is own title and subtype_name is empty.
|
|
73
|
-
{
|
|
74
|
-
"icon": "chart bar outline",
|
|
75
|
-
"id": "image-photo",
|
|
76
|
-
"subtype_name": "",
|
|
77
|
-
"type_name": "Photo",
|
|
78
|
-
},
|
|
79
|
-
# If parent type is itself (e.g. Publication), type_name is own title
|
|
80
|
-
# and subtype_name is empty.
|
|
81
|
-
{
|
|
82
|
-
"icon": "file alternate",
|
|
83
|
-
"id": "publication",
|
|
84
|
-
"subtype_name": "",
|
|
85
|
-
"type_name": "Publication",
|
|
86
|
-
},
|
|
87
|
-
# If corresponding parent type entry, type_name is parent's title
|
|
88
|
-
# and subtype_name is own title.
|
|
89
|
-
{
|
|
90
|
-
"icon": "file alternate",
|
|
91
|
-
"id": "publication-annotationcollection",
|
|
92
|
-
"subtype_name": "Annotation collection",
|
|
93
|
-
"type_name": "Publication",
|
|
94
|
-
},
|
|
95
|
-
]
|
|
96
|
-
|
|
97
|
-
# the choice of this filter isn't important for the test
|
|
98
|
-
result = options._resource_types(dsl.Q("term", tags="depositable"))
|
|
99
|
-
|
|
100
|
-
sorted_result = sorted(result, key=lambda e: e["id"])
|
|
101
|
-
assert expected == sorted_result
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def test_dump_subjects_vocabulary(running_app):
|
|
105
|
-
options = VocabulariesOptions()
|
|
106
|
-
expected = {
|
|
107
|
-
"limit_to": [
|
|
108
|
-
{"text": "All", "value": "all"},
|
|
109
|
-
{"text": "MeSH", "value": "MeSH"},
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
result = options.subjects()
|
|
114
|
-
|
|
115
|
-
assert expected == result
|
tests/ui/test_export_formats.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2021 CERN.
|
|
4
|
-
#
|
|
5
|
-
# Invenio-App-RDM is free software; you can redistribute it and/or modify
|
|
6
|
-
# it under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
-
|
|
8
|
-
"""Test that all export formats are working."""
|
|
9
|
-
|
|
10
|
-
import pytest
|
|
11
|
-
from invenio_cache import current_cache
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@pytest.fixture(scope="function")
|
|
15
|
-
def cache():
|
|
16
|
-
"""Clean cache"""
|
|
17
|
-
try:
|
|
18
|
-
current_cache.clear()
|
|
19
|
-
yield current_cache
|
|
20
|
-
finally:
|
|
21
|
-
current_cache.clear()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_export_formats(client, running_app, cache, record):
|
|
25
|
-
"""Test that all expected export formats are working."""
|
|
26
|
-
# Expected export formats:
|
|
27
|
-
formats = [
|
|
28
|
-
"json",
|
|
29
|
-
"json-ld",
|
|
30
|
-
"csl",
|
|
31
|
-
"datacite-json",
|
|
32
|
-
"datacite-xml",
|
|
33
|
-
"dublincore",
|
|
34
|
-
]
|
|
35
|
-
for f in formats:
|
|
36
|
-
res = client.get(f"/records/{record.id}/export/{f}")
|
|
37
|
-
assert res.status_code == 200
|
tests/ui/test_file_download.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2025 CERN.
|
|
4
|
-
# Copyright (C) 2025 KTH Royal Institute of Technology.
|
|
5
|
-
#
|
|
6
|
-
# Invenio-App-RDM is free software; you can redistribute it and/or modify
|
|
7
|
-
# it under the terms of the MIT License; see LICENSE file for more details.
|
|
8
|
-
|
|
9
|
-
from flask import url_for
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_file_download_with_and_without_preview_flag(
|
|
13
|
-
client_with_login, draft_with_file
|
|
14
|
-
):
|
|
15
|
-
"""Test file download both with and without preview flag."""
|
|
16
|
-
client = client_with_login
|
|
17
|
-
draft_id = draft_with_file["id"]
|
|
18
|
-
file_name = "article.txt"
|
|
19
|
-
|
|
20
|
-
# The draft's owner should be able to download its file from the preview page
|
|
21
|
-
url_with_preview = url_for(
|
|
22
|
-
"invenio_app_rdm_records.record_file_download",
|
|
23
|
-
pid_value=draft_id,
|
|
24
|
-
filename=file_name,
|
|
25
|
-
download=1,
|
|
26
|
-
preview=1,
|
|
27
|
-
)
|
|
28
|
-
response = client.get(url_with_preview)
|
|
29
|
-
assert (
|
|
30
|
-
response.status_code == 200
|
|
31
|
-
), "File download with preview flag should return 200"
|
|
32
|
-
|
|
33
|
-
# But since the draft isn't published yet, it can't be found without preview=1
|
|
34
|
-
url_without_preview = url_for(
|
|
35
|
-
"invenio_app_rdm_records.record_file_download",
|
|
36
|
-
pid_value=draft_id,
|
|
37
|
-
filename=file_name,
|
|
38
|
-
download=1,
|
|
39
|
-
)
|
|
40
|
-
response = client.get(url_without_preview)
|
|
41
|
-
assert (
|
|
42
|
-
response.status_code == 404
|
|
43
|
-
), "File download without preview flag should return 404"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def test_nonexistent_file_returns_404(client_with_login, draft_with_file):
|
|
47
|
-
"""Test that requesting a non-existent file returns 404 via the NoResultFound handler."""
|
|
48
|
-
client = client_with_login
|
|
49
|
-
draft_id = draft_with_file["id"]
|
|
50
|
-
fake_file = "nonexistent-file.pdf"
|
|
51
|
-
|
|
52
|
-
# Downloads for files that don't exist should return a 404, both without...
|
|
53
|
-
url_without_preview = url_for(
|
|
54
|
-
"invenio_app_rdm_records.record_file_download",
|
|
55
|
-
pid_value=draft_id,
|
|
56
|
-
filename=fake_file,
|
|
57
|
-
download=1,
|
|
58
|
-
)
|
|
59
|
-
response = client.get(url_without_preview)
|
|
60
|
-
assert response.status_code == 404, "Non-existent file should return 404"
|
|
61
|
-
|
|
62
|
-
# ... as well as with the preview=1 flag
|
|
63
|
-
url_with_preview = url_for(
|
|
64
|
-
"invenio_app_rdm_records.record_file_download",
|
|
65
|
-
pid_value=draft_id,
|
|
66
|
-
filename=fake_file,
|
|
67
|
-
download=1,
|
|
68
|
-
preview=1,
|
|
69
|
-
)
|
|
70
|
-
response = client.get(url_with_preview)
|
|
71
|
-
assert (
|
|
72
|
-
response.status_code == 404
|
|
73
|
-
), "Non-existent file with preview flag should return 404"
|