invenio-app-rdm 13.0.0b2.dev3__py2.py3-none-any.whl → 13.0.0b2.dev4__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.
@@ -17,6 +17,6 @@
17
17
  #
18
18
  # See PEP 0440 for details - https://www.python.org/dev/peps/pep-0440
19
19
 
20
- __version__ = "13.0.0b2.dev3"
20
+ __version__ = "13.0.0b2.dev4"
21
21
 
22
22
  __all__ = ("__version__",)
invenio_app_rdm/config.py CHANGED
@@ -964,6 +964,8 @@ APP_RDM_DEPOSIT_FORM_PUBLISH_MODAL_EXTRA = ""
964
964
 
965
965
  APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = "invenio_app_rdm/records/detail.html"
966
966
 
967
+ APP_RDM_RECORD_LANDING_PAGE_FAIR_SIGNPOSTING_LEVEL_1_ENABLED = False
968
+
967
969
  APP_RDM_RECORD_THUMBNAIL_SIZES = [10, 50, 100, 250, 750, 1200]
968
970
  """Allowed record thumbnail sizes."""
969
971
 
@@ -398,13 +398,25 @@ def add_signposting_landing_page(f):
398
398
  response = make_response(f(*args, **kwargs))
399
399
 
400
400
  # Relies on other decorators having operated before it
401
- record = kwargs["record"]
401
+ if current_app.config[
402
+ "APP_RDM_RECORD_LANDING_PAGE_FAIR_SIGNPOSTING_LEVEL_1_ENABLED"
403
+ ]:
404
+ record = kwargs["record"]
405
+
406
+ signposting_headers = (
407
+ FAIRSignpostingProfileLvl1Serializer().serialize_object(
408
+ record.to_dict()
409
+ )
410
+ )
402
411
 
403
- signposting_headers = FAIRSignpostingProfileLvl1Serializer().serialize_object(
404
- record.to_dict()
405
- )
412
+ response.headers["Link"] = signposting_headers
413
+ else:
414
+ pid_value = kwargs["pid_value"]
415
+ signposting_link = record_url_for(_app="api", pid_value=pid_value)
406
416
 
407
- response.headers["Link"] = signposting_headers
417
+ response.headers["Link"] = (
418
+ f'<{signposting_link}> ; rel="linkset" ; type="application/linkset+json"' # fmt: skip
419
+ )
408
420
 
409
421
  return response
410
422
 
invenio_app_rdm/tasks.py CHANGED
@@ -18,7 +18,10 @@ from .utils.files import send_integrity_report_email
18
18
  def file_integrity_report():
19
19
  """Send a report of uhealthy/missing files to system admins."""
20
20
  # First retry verifying files that errored during their last check
21
- files = FileInstance.query.filter(FileInstance.last_check.is_(None))
21
+ files = FileInstance.query.filter(
22
+ FileInstance.last_check.is_(None),
23
+ FileInstance.uri.is_not(None),
24
+ )
22
25
  for f in files:
23
26
  try:
24
27
  f.clear_last_check()
@@ -32,7 +35,8 @@ def file_integrity_report():
32
35
  FileInstance.query.filter(
33
36
  sa.or_(
34
37
  FileInstance.last_check.is_(None), FileInstance.last_check.is_(False)
35
- )
38
+ ),
39
+ FileInstance.uri.is_not(None),
36
40
  )
37
41
  .order_by(FileInstance.created.desc())
38
42
  .all()
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  * // This file is part of Invenio-App-Rdm
3
3
  * // Copyright (C) 2025 CERN.
4
+ * // Copyright (C) 2025 Graz University of Technology.
4
5
  * //
5
6
  * // Invenio-App-Rdm is free software; you can redistribute it and/or modify it
6
7
  * // under the terms of the MIT License; see LICENSE file for more details.
@@ -81,3 +82,8 @@ CompareRevisionsDropdown.propTypes = {
81
82
  srcRevision: PropTypes.object,
82
83
  targetRevision: PropTypes.object,
83
84
  };
85
+
86
+ CompareRevisionsDropdown.defaultProps = {
87
+ srcRevision: 0,
88
+ targetRevision: 0,
89
+ };
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  * // This file is part of Invenio-App-Rdm
3
3
  * // Copyright (C) 2025 CERN.
4
+ * // Copyright (C) 2025 Graz University of Technology.
4
5
  * //
5
6
  * // Invenio-App-Rdm is free software; you can redistribute it and/or modify it
6
7
  * // under the terms of the MIT License; see LICENSE file for more details.
@@ -75,3 +76,7 @@ RevisionsDiffViewer.propTypes = {
75
76
  diff: PropTypes.object,
76
77
  viewerProps: PropTypes.object.isRequired,
77
78
  };
79
+
80
+ RevisionsDiffViewer.defaultProps = {
81
+ diff: {},
82
+ };
@@ -1,6 +1,7 @@
1
1
  /*
2
2
  * // This file is part of Invenio-App-Rdm
3
3
  * // Copyright (C) 2025 CERN.
4
+ * // Copyright (C) 2025 Graz University of Technology.
4
5
  * //
5
6
  * // Invenio-App-Rdm is free software; you can redistribute it and/or modify it
6
7
  * // under the terms of the MIT License; see LICENSE file for more details.
@@ -28,6 +29,14 @@ export class CompareRevisions extends Component {
28
29
  };
29
30
  }
30
31
 
32
+ componentDidMount() {
33
+ this.fetchRevisions();
34
+ }
35
+
36
+ componentWillUnmount() {
37
+ this.cancellableAction && this.cancellableAction.cancel();
38
+ }
39
+
31
40
  async fetchRevisions() {
32
41
  const { resource } = this.props;
33
42
  this.setState({ loading: true });
@@ -50,14 +59,6 @@ export class CompareRevisions extends Component {
50
59
  }
51
60
  }
52
61
 
53
- componentDidMount() {
54
- this.fetchRevisions();
55
- }
56
-
57
- componentWillUnmount() {
58
- this.cancellableAction && this.cancellableAction.cancel();
59
- }
60
-
61
62
  handleModalClose = () => {
62
63
  const { actionCancelCallback } = this.props;
63
64
  actionCancelCallback();
@@ -100,7 +101,7 @@ export class CompareRevisions extends Component {
100
101
  </Modal.Content>
101
102
  )}
102
103
  <Modal.Content scrolling>
103
- <RevisionsDiffViewer diff={this.state.diff} />
104
+ <RevisionsDiffViewer diff={diff} />
104
105
  </Modal.Content>
105
106
  </Modal.Content>
106
107
  <Modal.Actions>
@@ -235,7 +235,7 @@
235
235
  in exactly the same order, and thus for instance would not match a record
236
236
  containing the phrase <em>"open access and science"</em>. A proximity search
237
237
  allows that the terms are not in the exact order and may include other terms
238
- inbetween. The degree of flexiblity is specified by an integer afterwards:
238
+ in between. The degree of flexibility is specified by an integer afterwards:
239
239
  </p>
240
240
  <p>
241
241
  <strong>Example:</strong>
invenio_app_rdm/urls.py CHANGED
@@ -28,6 +28,9 @@ Design decisions:
28
28
  - Generated urls are absolute for now
29
29
  """
30
30
 
31
+ import unicodedata
32
+ from urllib.parse import quote
33
+
31
34
  from flask import current_app
32
35
 
33
36
 
@@ -49,7 +52,14 @@ def record_url_for(_app="ui", pid_value=""):
49
52
 
50
53
  def download_url_for(pid_value="", filename=""):
51
54
  """Return url for download route."""
52
- url_prefix = current_app.config.get(f"SITE_UI_URL", "")
55
+ url_prefix = current_app.config.get("SITE_UI_URL", "")
56
+
57
+ # see https://github.com/pallets/werkzeug/blob/main/src/werkzeug/utils.py#L456-L465
58
+ try:
59
+ filename.encode("ascii")
60
+ except UnicodeEncodeError:
61
+ # safe = RFC 5987 attr-char
62
+ filename = quote(filename, safe="!#$&+-.^_`|~")
53
63
 
54
64
  # We use [] so that this fails and brings to attention the configuration
55
65
  # problem if APP_RDM_ROUTES.record_file_download is missing
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: invenio-app-rdm
3
- Version: 13.0.0b2.dev3
3
+ Version: 13.0.0b2.dev4
4
4
  Summary: Invenio Research Data Management.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-app-rdm
6
6
  Author: CERN
@@ -96,6 +96,12 @@ https://inveniordm.docs.cern.ch
96
96
  Changes
97
97
  =======
98
98
 
99
+ Version v13.0.0b2.dev4 (released 2025-03-10)
100
+
101
+ - views: FAIR signposting level 1 support (config flag)
102
+ - tasks: skip health checks for files that don't have a uri
103
+ - views: signposting: files: fix filename encoding issues for downloads
104
+
99
105
  Version v13.0.0b2.dev3 (released 2025-02-21)
100
106
 
101
107
  - views: FAIR signposting level 1 support
@@ -1,9 +1,9 @@
1
- invenio_app_rdm/__init__.py,sha256=aMf0xqH7NgrjmJzUlTPJbSy_JBYRqRI67Y8cOfcLVaY,699
1
+ invenio_app_rdm/__init__.py,sha256=hJh2ID9D2F8shJQctjpBsnXXNr6rUgqvkW32PXDpBj8,699
2
2
  invenio_app_rdm/cli.py,sha256=G6QqNU2W6n6ICtTMnpeKFXIsdorncDmVXwwwsGH5F2k,2746
3
- invenio_app_rdm/config.py,sha256=B6WFMqTVF_gb3Ppenun2f8Vw4Ak1ORd4Di27Ty1nOP8,50378
3
+ invenio_app_rdm/config.py,sha256=aQHeG7QxiKx01eDi1Xo7hsOfyAfe_yb8SNrq-CDOYag,50448
4
4
  invenio_app_rdm/ext.py,sha256=PkZhATGJDgYqBJQh41NdvBZWR83mgI3Eej6rj10UVJE,5278
5
- invenio_app_rdm/tasks.py,sha256=XAbl8KeAWaJ5lC_4OUWUPstvCT7lYs5tRR1zSVBDfRk,1275
6
- invenio_app_rdm/urls.py,sha256=VRbpuN3kQ2fcmKvEIGQ5O1EnaSsEE2kyhLwUmONwZO8,2192
5
+ invenio_app_rdm/tasks.py,sha256=FyrIQXVuPjms-dNEnLrVmmdwrX_IykJ87gcSNgOR6O0,1373
6
+ invenio_app_rdm/urls.py,sha256=8S95QSs4yS0rtORsd4veo--rF3LSLwZenoowJ5ubbmM,2496
7
7
  invenio_app_rdm/administration/__init__.py,sha256=8r9LeoE9fNHZSVS5QsCfVhRU7MAiEOWJk9MA3Y--4F8,251
8
8
  invenio_app_rdm/administration/domains/__init__.py,sha256=Qob5kqjRPxpuSE5yDV2tesN6tmaKp5JcxCxGA8Mrcak,487
9
9
  invenio_app_rdm/administration/domains/domains.py,sha256=vafLa-mqkg_tQLjx328E64P_4mksB5kjBlsfunvdatg,5599
@@ -80,7 +80,7 @@ invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/
80
80
  invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/stats_popup.html,sha256=5SVzfIS15Aro2Itd2BiaLbMXm0cvvwk6ZCdYjuSwhBw,625
81
81
  invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/version.html,sha256=JpE4e6RpbSR2pQD1rOsfvzD2ur584aRfBWUUap2IMBA,688
82
82
  invenio_app_rdm/records_ui/views/__init__.py,sha256=4NxQNADuvMsblEsGd3zkKXSNR5_4eLMcFEFYvc6NxVc,5718
83
- invenio_app_rdm/records_ui/views/decorators.py,sha256=khRmZBd5oh6Kjt9m431S7z9g-_11PZf7FAH235F2eDU,15296
83
+ invenio_app_rdm/records_ui/views/decorators.py,sha256=XUSPpstYyh72IdNaIO4wz3sw1fjI_2DNGsKdUu3ueL4,15769
84
84
  invenio_app_rdm/records_ui/views/deposits.py,sha256=ZQSlYugqZX1jnS0GFNtJQVq2_KyDS_ECzp1S26qDGAs,21337
85
85
  invenio_app_rdm/records_ui/views/filters.py,sha256=Rm55fXJv97cqq8B_6KCe-3PxxHUH4VRu-jd9fTea6r4,6994
86
86
  invenio_app_rdm/records_ui/views/records.py,sha256=GdxG3JnXrV1QT0KxOqeYWoDGIiZRZ9w5poihPPd-wTo,16428
@@ -105,10 +105,10 @@ invenio_app_rdm/theme/views.py,sha256=UJs2_C28BWsXY1JqbRK4_ML1JRtGo1yM2S0_W37JJo
105
105
  invenio_app_rdm/theme/webpack.py,sha256=5ucwIJQgM1y9EFdRcsxv_ThPs7hXRzdmipVBxoU1McI,5090
106
106
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js,sha256=2-BWDEH3YQPwPt1ey3jUHnMrKTyb0JBPRlydk5_reH8,4151
107
107
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js,sha256=zKROcc3qE64-UhM8ha42K-EDDxAXMupxoocZZ9bjEHo,3452
108
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/CompareRevisionsDropdown.js,sha256=h7ilYSO4XYwdIqO75R1aREzCdp-EFeHbMbYvQ-Iq41A,2342
108
+ invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/CompareRevisionsDropdown.js,sha256=BNdMxfFYPhlrGKPg47oc4X8ILllfCngN61L1b7Yt_8Q,2483
109
109
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUser.js,sha256=GmZGEPOylGXr6fyNJxS_0hPwCGdO98F2u6Pn8Qrt9ew,2291
110
110
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUserForm.js,sha256=qsjNiOsHWx9rrP3uA4nxthUEoY9b82n0IO8PfdObxHQ,6815
111
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/RevisionsDiffViewer.js,sha256=N8dEcGupDr1_TG858E6uU64TDtGVR4zJ_mgKiASG90s,1823
111
+ invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/RevisionsDiffViewer.js,sha256=-2khcBmWr3zztAjy3mRz4d9gu8b8IAZtWbcnwnD5eAk,1932
112
112
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/SetQuotaAction.js,sha256=wwvYfTJ7pBEdoeqcEqmxFLaEwpJnnFW0oRQTyAdDSBw,3038
113
113
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/SetQuotaForm.js,sha256=Ltr03KlCogkg2NjqWc1GkxJlYPWB2LDLHL04w6eJiRU,5749
114
114
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/index.js,sha256=soELMxc1jf_rL62CJ9wtWGVG13yk1PRY7JqseqnKkqU,297
@@ -116,7 +116,7 @@ invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/domai
116
116
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/domains/search/SearchResultItemLayout.js,sha256=sWIHw6tSCmRa0dYCHTa-fbxnHr9MhyDhMUiGlGV-HWE,6097
117
117
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/domains/search/index.js,sha256=uajCJbGiHGjRH_YapCGGXATKtAUlXTr0jirx1UfqjCQ,283
118
118
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/drafts/index.js,sha256=DuPY4wnnwyWF61Oyef1S4SvQrg-DrkZZjjQKlA0DeJo,1159
119
- invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/records/CompareRevisions.js,sha256=wqJrxHi5kW83PJhJMinpuX-He1NPBVjRVHyyhBoHoQ4,3723
119
+ invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/records/CompareRevisions.js,sha256=J-bx3k8PPSAFg669w_rhZVuSFDS2RjcKyyqxZ029FFU,3768
120
120
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/records/RecordActions.js,sha256=FAjkK7TZ4ebjsQh1ZcFFHkVePP2T8msa1OAIjxktKJo,1935
121
121
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/records/RecordResourceActions.js,sha256=rrQhCfw1Q8n5SJ9aT-XfZfadEZRK9b1N6hzGkbMAnrU,5528
122
122
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/records/RemovalReasonsSelect.js,sha256=8y1YRo1ZyqDfeQL4aNbO9ig3689YpzEBse8kLf_qI8o,2192
@@ -396,7 +396,7 @@ invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/searchbar.html,sha25
396
396
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/site_footer.html,sha256=O4914C0hNrKtHreAanMbhRUiCfb8aubr6pV2chXB_BQ,821
397
397
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/files_integrity_report/email/files_integrity_report.html,sha256=27L0XZKP5bkOu4tx0QmMMDwIPdtFU_dyVfTfRk9E5QQ,1063
398
398
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/search.de.html,sha256=gefXaGv-ylkBUbvXXJe5EcTS66qoY0-v0XesXICX5_E,9310
399
- invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/search.en.html,sha256=HwZW7ZcBWV39NaYXhoIbGlep7aYoDO-in36jYSjVJMY,8790
399
+ invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/search.en.html,sha256=-EZdjhc4JslSq37_QN3KRL01LBwLJENkRtwBJ-PLSzc,8792
400
400
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/statistics.en.html,sha256=gQSJsmsXaLLA8KqEjkyxn7j299Kc0hnjA0sXq0oXeuI,7780
401
401
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/help/versioning.en.html,sha256=Rfd4-1vpU92VxppMTLGlS7uzqXWZUtGBARJTalUFuxg,6066
402
402
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/macros/records_list.html,sha256=GhHhRCn2lD9zyZ7J7_GiLqTQSHGxpWbiuYdZp8ft0bU,1081
@@ -552,12 +552,12 @@ tests/ui/conftest.py,sha256=id6A9VbwHQtnr8bzQyQXDBDoKUHx8uufuhRVk02mqbk,3015
552
552
  tests/ui/test_deposits.py,sha256=BehQzo1r3_f4Uc9jcXRddd9bS5GfQ3jRRYOM0AMbi3w,3792
553
553
  tests/ui/test_export_formats.py,sha256=pCXJCTp9ykEWb2oB-ynGjQDhFaVsOs31ym0stwfWCaQ,909
554
554
  tests/ui/test_filters.py,sha256=Q90wsJffjMVir7wNX8taGf2KZleLtPbXZXHLTkBpzLA,284
555
- tests/ui/test_signposting_ui.py,sha256=Z2g63RgGKWbktIYWBqrYQdwhUZn0Q1d8M3h071wslqY,3164
555
+ tests/ui/test_signposting_ui.py,sha256=KCSjQlMD2VKlwQCyZYDwYjtVNL35x3u-ZC4ceD5y21w,3847
556
556
  tests/ui/test_static.py,sha256=vO3OQAOhrQESJifnQfM1pw7JYz3J874O8BAb7Cc_PPA,868
557
557
  tests/ui/test_stats_ui.py,sha256=LHa_0hjvpYvliSk_jknWy-90CO82jVElUfK5Ua_ZmfA,3554
558
- invenio_app_rdm-13.0.0b2.dev3.dist-info/LICENSE,sha256=AZXFHRrZa5s4m9DV7zZr4bPGTMUvcEPCodeV_AmFI8k,1204
559
- invenio_app_rdm-13.0.0b2.dev3.dist-info/METADATA,sha256=ckaiFKCe_NCNweAQWf9LJhjyFbaJF0kZptUDZLKWo98,10347
560
- invenio_app_rdm-13.0.0b2.dev3.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
561
- invenio_app_rdm-13.0.0b2.dev3.dist-info/entry_points.txt,sha256=r1vTqYNABeWqRMWitzyR9FnBsAy-KYZKZCp95IziyLY,2070
562
- invenio_app_rdm-13.0.0b2.dev3.dist-info/top_level.txt,sha256=NqTqrntInEAci7EXcNBvouXFMqwyjVQhEI0b7izYRBY,22
563
- invenio_app_rdm-13.0.0b2.dev3.dist-info/RECORD,,
558
+ invenio_app_rdm-13.0.0b2.dev4.dist-info/LICENSE,sha256=AZXFHRrZa5s4m9DV7zZr4bPGTMUvcEPCodeV_AmFI8k,1204
559
+ invenio_app_rdm-13.0.0b2.dev4.dist-info/METADATA,sha256=llhPnYj4_mF5zohdgicsNAdMhTOiADuTi1v_Z7lUUvw,10582
560
+ invenio_app_rdm-13.0.0b2.dev4.dist-info/WHEEL,sha256=SrDKpSbFN1G94qcmBqS9nyHcDMp9cUS9OC06hC0G3G0,109
561
+ invenio_app_rdm-13.0.0b2.dev4.dist-info/entry_points.txt,sha256=r1vTqYNABeWqRMWitzyR9FnBsAy-KYZKZCp95IziyLY,2070
562
+ invenio_app_rdm-13.0.0b2.dev4.dist-info/top_level.txt,sha256=NqTqrntInEAci7EXcNBvouXFMqwyjVQhEI0b7izYRBY,22
563
+ invenio_app_rdm-13.0.0b2.dev4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
@@ -13,9 +13,19 @@ import pytest
13
13
 
14
14
 
15
15
  @pytest.mark.parametrize("http_method", ["head", "get"])
16
+ @pytest.mark.parametrize("level_1_enabled", [True, False])
16
17
  def test_link_in_landing_page_response_headers(
17
- running_app, client, record_with_file, http_method
18
+ running_app, app, client, record_with_file, http_method, level_1_enabled
18
19
  ):
20
+ previous_config = app.config[
21
+ "APP_RDM_RECORD_LANDING_PAGE_FAIR_SIGNPOSTING_LEVEL_1_ENABLED"
22
+ ]
23
+
24
+ if level_1_enabled:
25
+ app.config["APP_RDM_RECORD_LANDING_PAGE_FAIR_SIGNPOSTING_LEVEL_1_ENABLED"] = (
26
+ True
27
+ )
28
+
19
29
  client_http_method = getattr(client, http_method)
20
30
  res = client_http_method(f"/records/{record_with_file.id}")
21
31
 
@@ -29,17 +39,27 @@ def test_link_in_landing_page_response_headers(
29
39
  # - a cite-as since it has no DOI.
30
40
  # - a license.
31
41
 
32
- # There should be at least 10 export formats supported (e.g. "application/dcat+xml", "application/x-bibtex", etc.).
33
- assert sum('; rel="describedby" ;' in header for header in link_headers) >= 10
42
+ # There should be at least one link to a linkset (e.g. "application/linkset" and/or "application/linkset+json")
43
+ assert sum('; rel="linkset" ;' in header for header in link_headers) >= 1
34
44
 
35
- # There should be at least one file in the record.
36
- assert sum('; rel="item" ;' in header for header in link_headers) >= 1
45
+ if level_1_enabled:
46
+ # There should be at least 10 export formats supported (e.g. "application/dcat+xml", "application/x-bibtex", etc.).
47
+ assert sum('; rel="describedby" ;' in header for header in link_headers) >= 10
37
48
 
38
- # There should be at least one description of the type of the record (e.g. "https://schema.org/Photograph").
39
- assert sum('; rel="type"' in header for header in link_headers) >= 1
49
+ # There should be at least one file in the record.
50
+ assert sum('; rel="item" ;' in header for header in link_headers) >= 1
40
51
 
41
- # There should be at least one link to a linkset (e.g. "application/linkset" and/or "application/linkset+json")
42
- assert sum('; rel="linkset" ;' in header for header in link_headers) >= 1
52
+ # There should be at least one description of the type of the record (e.g. "https://schema.org/Photograph").
53
+ assert sum('; rel="type"' in header for header in link_headers) >= 1
54
+ else:
55
+ # The only link headers should be linkset headers.
56
+ assert sum('; rel="linkset" ;' in header for header in link_headers) == len(
57
+ link_headers
58
+ )
59
+
60
+ app.config["APP_RDM_RECORD_LANDING_PAGE_FAIR_SIGNPOSTING_LEVEL_1_ENABLED"] = (
61
+ previous_config
62
+ )
43
63
 
44
64
 
45
65
  @pytest.mark.parametrize("http_method", ["head", "get"])