invenio-app-ils 4.5.0__py2.py3-none-any.whl → 5.0.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. invenio_app_ils/__init__.py +1 -1
  2. invenio_app_ils/assets/semantic-ui/less/theme.config +103 -0
  3. invenio_app_ils/circulation/api.py +9 -5
  4. invenio_app_ils/circulation/config.py +1 -0
  5. invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py +1 -1
  6. invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +2 -2
  7. invenio_app_ils/circulation/notifications/api.py +9 -1
  8. invenio_app_ils/circulation/notifications/messages.py +2 -1
  9. invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/update_dates.html +19 -0
  10. invenio_app_ils/cli.py +92 -64
  11. invenio_app_ils/config.py +10 -2
  12. invenio_app_ils/documents/loaders/jsonschemas/document.py +1 -1
  13. invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +2 -2
  14. invenio_app_ils/patrons/anonymization.py +0 -4
  15. invenio_app_ils/series/loaders/jsonschemas/series.py +1 -1
  16. invenio_app_ils/webpack.py +27 -0
  17. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/METADATA +56 -43
  18. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/RECORD +24 -112
  19. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/entry_points.txt +3 -0
  20. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/top_level.txt +0 -1
  21. invenio_app_ils/notifications/admin.py +0 -57
  22. tests/__init__.py +0 -8
  23. tests/api/__init__.py +0 -8
  24. tests/api/acquisition/__init__.py +0 -8
  25. tests/api/acquisition/test_acq_orders_crud.py +0 -99
  26. tests/api/acquisition/test_acq_orders_permissions.py +0 -104
  27. tests/api/acquisition/test_acq_providers_permissions.py +0 -83
  28. tests/api/circulation/__init__.py +0 -8
  29. tests/api/circulation/test_expired_loans.py +0 -88
  30. tests/api/circulation/test_loan_bulk_extend.py +0 -169
  31. tests/api/circulation/test_loan_checkout.py +0 -422
  32. tests/api/circulation/test_loan_default_durations.py +0 -43
  33. tests/api/circulation/test_loan_document_resolver.py +0 -18
  34. tests/api/circulation/test_loan_extend.py +0 -122
  35. tests/api/circulation/test_loan_item_permissions.py +0 -135
  36. tests/api/circulation/test_loan_item_resolver.py +0 -26
  37. tests/api/circulation/test_loan_list_permissions.py +0 -98
  38. tests/api/circulation/test_loan_patron_resolver.py +0 -38
  39. tests/api/circulation/test_loan_request.py +0 -338
  40. tests/api/circulation/test_loan_update.py +0 -150
  41. tests/api/circulation/test_notifications.py +0 -221
  42. tests/api/conftest.py +0 -227
  43. tests/api/document_requests/__init__.py +0 -8
  44. tests/api/document_requests/test_document_requests.py +0 -131
  45. tests/api/document_requests/test_document_requests_permissions.py +0 -159
  46. tests/api/document_requests/test_notifications_filter.py +0 -35
  47. tests/api/ill/__init__.py +0 -8
  48. tests/api/ill/test_ill_brw_crud.py +0 -74
  49. tests/api/ill/test_ill_brw_reqs_patron_loan_create_action.py +0 -198
  50. tests/api/ill/test_ill_brw_reqs_patron_loan_extension_actions.py +0 -280
  51. tests/api/ill/test_ill_brw_reqs_permissions.py +0 -163
  52. tests/api/ill/test_ill_providers_permissions.py +0 -82
  53. tests/api/ils/__init__.py +0 -8
  54. tests/api/ils/documents/__init__.py +0 -8
  55. tests/api/ils/documents/test_document_crud.py +0 -57
  56. tests/api/ils/documents/test_document_permissions.py +0 -100
  57. tests/api/ils/documents/test_document_resolvers.py +0 -35
  58. tests/api/ils/eitems/__init__.py +0 -8
  59. tests/api/ils/eitems/test_eitems_crud.py +0 -42
  60. tests/api/ils/eitems/test_eitems_permissions.py +0 -85
  61. tests/api/ils/eitems/test_files.py +0 -162
  62. tests/api/ils/items/__init__.py +0 -8
  63. tests/api/ils/items/test_apis.py +0 -43
  64. tests/api/ils/items/test_items_crud.py +0 -99
  65. tests/api/ils/items/test_items_permissions.py +0 -107
  66. tests/api/ils/records_relations/__init__.py +0 -8
  67. tests/api/ils/records_relations/helpers.py +0 -115
  68. tests/api/ils/records_relations/test_records_relations_parentchild.py +0 -560
  69. tests/api/ils/records_relations/test_records_relations_sequence.py +0 -294
  70. tests/api/ils/records_relations/test_records_relations_siblings.py +0 -751
  71. tests/api/ils/series/__init__.py +0 -8
  72. tests/api/ils/series/test_series_permissions.py +0 -95
  73. tests/api/ils/test_anonymization.py +0 -181
  74. tests/api/ils/test_apis.py +0 -76
  75. tests/api/ils/test_closures.py +0 -353
  76. tests/api/ils/test_errors.py +0 -125
  77. tests/api/ils/test_facets.py +0 -88
  78. tests/api/ils/test_internal_locations.py +0 -96
  79. tests/api/ils/test_loaders.py +0 -51
  80. tests/api/ils/test_metadata_extensions.py +0 -206
  81. tests/api/ils/test_notifications.py +0 -173
  82. tests/api/ils/test_notifications_mails.py +0 -37
  83. tests/api/ils/test_notifications_permissions.py +0 -55
  84. tests/api/ils/test_patrons.py +0 -102
  85. tests/api/ils/test_record_delete.py +0 -42
  86. tests/api/ils/test_record_permissions.py +0 -132
  87. tests/api/ils/test_resolvers.py +0 -205
  88. tests/api/ils/test_stats.py +0 -142
  89. tests/api/ils/test_tasks.py +0 -209
  90. tests/api/ils/test_vocabularies.py +0 -35
  91. tests/conftest.py +0 -221
  92. tests/data/acq_orders.json +0 -110
  93. tests/data/acq_providers.json +0 -12
  94. tests/data/document_requests.json +0 -77
  95. tests/data/documents.json +0 -238
  96. tests/data/eitems.json +0 -71
  97. tests/data/ill_borrowing_requests.json +0 -77
  98. tests/data/ill_providers.json +0 -12
  99. tests/data/internal_locations.json +0 -22
  100. tests/data/items.json +0 -304
  101. tests/data/loans.json +0 -133
  102. tests/data/loans_most_loaned.json +0 -128
  103. tests/data/locations.json +0 -26
  104. tests/data/series.json +0 -33
  105. tests/helpers.py +0 -107
  106. tests/templates/notifications/title_body.html +0 -8
  107. tests/templates/notifications/title_body_html.html +0 -13
  108. tests/templates/notifications/title_body_html_ctx.html +0 -13
  109. tests/templates/notifications/title_only.html +0 -3
  110. tests/test_post_logout_redirect.py +0 -23
  111. tests/test_version.py +0 -17
  112. /tests/templates/notifications/blank.html → /invenio_app_ils/assets/semantic-ui/templates/.gitkeep +0 -0
  113. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/WHEEL +0 -0
  114. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/AUTHORS.rst +0 -0
  115. {invenio_app_ils-4.5.0.dist-info → invenio_app_ils-5.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,560 +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 parent child."""
9
-
10
- import json
11
-
12
- import pytest
13
- from flask import url_for
14
-
15
- from invenio_app_ils.errors import RecordRelationsError
16
- from invenio_app_ils.records_relations.api import RecordRelationsParentChild
17
- from invenio_app_ils.relations.api import Relation
18
- from tests.helpers import user_login
19
-
20
- from .helpers import (
21
- recrel_assert_record_relations,
22
- recrel_choose_endpoints_and_do_request,
23
- )
24
-
25
-
26
- def _test_pc_mm_document(client, json_headers):
27
- """Test create and delete relations MM->Document."""
28
-
29
- parent_pid_value = "serid-1"
30
- parent_pid_type = "serid"
31
- child_pid_value = "docid-1"
32
- child_pid_type = "docid"
33
- relation_type = "multipart_monograph"
34
-
35
- payload = {
36
- "parent_pid_value": parent_pid_value,
37
- "parent_pid_type": parent_pid_type,
38
- "child_pid_value": child_pid_value,
39
- "child_pid_type": child_pid_type,
40
- "relation_type": relation_type,
41
- }
42
-
43
- def _test_create_mm_document(create_using_pid1=True):
44
- """Test relation creation of Multipart Monograph and Document."""
45
-
46
- parent, child = recrel_choose_endpoints_and_do_request(
47
- (client, json_headers, "POST"),
48
- (
49
- parent_pid_value,
50
- parent_pid_type,
51
- child_pid_value,
52
- child_pid_type,
53
- ),
54
- payload,
55
- create_using_pid1=create_using_pid1,
56
- )
57
-
58
- recrel_assert_record_relations(parent, expected={"relations": {}})
59
-
60
- recrel_assert_record_relations(
61
- child,
62
- expected={
63
- "relations": {
64
- "multipart_monograph": [
65
- {
66
- "pid_value": parent_pid_value,
67
- "pid_type": parent_pid_type,
68
- "relation_type": "multipart_monograph",
69
- "record_metadata": {
70
- "title": parent["title"],
71
- "mode_of_issuance": parent["mode_of_issuance"],
72
- },
73
- }
74
- ]
75
- }
76
- },
77
- )
78
-
79
- def _test_delete_mm_document(create_using_pid1=True):
80
- """Test relation deletion of Multipart Monograph and Document."""
81
-
82
- parent, child = recrel_choose_endpoints_and_do_request(
83
- (client, json_headers, "DELETE"),
84
- (
85
- parent_pid_value,
86
- parent_pid_type,
87
- child_pid_value,
88
- child_pid_type,
89
- ),
90
- payload,
91
- create_using_pid1=create_using_pid1,
92
- )
93
-
94
- recrel_assert_record_relations(parent, expected={"relations": {}})
95
- recrel_assert_record_relations(child, expected={"relations": {}})
96
-
97
- _test_create_mm_document()
98
- _test_delete_mm_document()
99
- _test_create_mm_document(create_using_pid1=False)
100
- _test_delete_mm_document(create_using_pid1=False)
101
- # recreate for the next one, to have some more valuable test data
102
- _test_create_mm_document()
103
-
104
-
105
- def _test_pc_mm_document_with_volume(client, json_headers):
106
- """Test create and delete relations MM->Document with volume."""
107
-
108
- parent_pid_value = "serid-1"
109
- parent_pid_type = "serid"
110
- child_pid_value = "docid-2"
111
- child_pid_type = "docid"
112
- relation_type = "multipart_monograph"
113
-
114
- payload = {
115
- "parent_pid_value": parent_pid_value,
116
- "parent_pid_type": parent_pid_type,
117
- "child_pid_value": child_pid_value,
118
- "child_pid_type": child_pid_type,
119
- "relation_type": relation_type,
120
- "volume": "v.3",
121
- }
122
-
123
- def _test_create_mm_document_with_volume(create_using_pid1=True):
124
- """Test relation creation with volume of MM and Document."""
125
-
126
- parent, child = recrel_choose_endpoints_and_do_request(
127
- (client, json_headers, "POST"),
128
- (
129
- parent_pid_value,
130
- parent_pid_type,
131
- child_pid_value,
132
- child_pid_type,
133
- ),
134
- payload,
135
- create_using_pid1=create_using_pid1,
136
- )
137
-
138
- recrel_assert_record_relations(
139
- parent,
140
- expected={
141
- "relations": {},
142
- },
143
- )
144
-
145
- recrel_assert_record_relations(
146
- child,
147
- expected={
148
- "relations": {
149
- "multipart_monograph": [
150
- {
151
- "pid_value": parent_pid_value,
152
- "pid_type": parent_pid_type,
153
- "volume": "v.3",
154
- "relation_type": "multipart_monograph",
155
- "record_metadata": {
156
- "title": parent["title"],
157
- "mode_of_issuance": parent["mode_of_issuance"],
158
- },
159
- }
160
- ]
161
- },
162
- "relations_extra_metadata": {
163
- "multipart_monograph": [
164
- {
165
- "pid_value": parent_pid_value,
166
- "pid_type": parent_pid_type,
167
- "volume": "v.3",
168
- }
169
- ]
170
- },
171
- },
172
- )
173
-
174
- def _test_delete_mm_document_with_volume(create_using_pid1=True):
175
- """Test relation deletion with volume of MM and Document."""
176
-
177
- parent, child = recrel_choose_endpoints_and_do_request(
178
- (client, json_headers, "DELETE"),
179
- (
180
- parent_pid_value,
181
- parent_pid_type,
182
- child_pid_value,
183
- child_pid_type,
184
- ),
185
- payload,
186
- create_using_pid1=create_using_pid1,
187
- )
188
-
189
- recrel_assert_record_relations(parent, expected={"relations": {}})
190
- recrel_assert_record_relations(child, expected={"relations": {}})
191
-
192
- _test_create_mm_document_with_volume()
193
- _test_delete_mm_document_with_volume()
194
- _test_create_mm_document_with_volume(create_using_pid1=False)
195
- _test_delete_mm_document_with_volume(create_using_pid1=False)
196
- # recreate for the next one, to have some more valuable test data
197
- _test_create_mm_document_with_volume()
198
-
199
-
200
- def _test_pc_serial_to_mm(client, json_headers):
201
- """Test relation create/delete of Serial and Multipart Monograph."""
202
- parent_pid_value = "serid-3"
203
- parent_pid_type = "serid"
204
- child_pid_value = "serid-1"
205
- child_pid_type = "serid"
206
- relation_type = "serial"
207
-
208
- payload = {
209
- "parent_pid_value": parent_pid_value,
210
- "parent_pid_type": parent_pid_type,
211
- "child_pid_value": child_pid_value,
212
- "child_pid_type": child_pid_type,
213
- "relation_type": relation_type,
214
- "volume": "vol. 1",
215
- }
216
-
217
- def _test_create_serial_to_mm(create_using_pid1=True):
218
- """Test relation create of Serial and Multipart Monograph."""
219
-
220
- parent, child = recrel_choose_endpoints_and_do_request(
221
- (client, json_headers, "POST"),
222
- (
223
- parent_pid_value,
224
- parent_pid_type,
225
- child_pid_value,
226
- child_pid_type,
227
- ),
228
- payload,
229
- create_using_pid1=create_using_pid1,
230
- )
231
-
232
- recrel_assert_record_relations(
233
- parent,
234
- expected={
235
- "relations": {},
236
- },
237
- )
238
-
239
- recrel_assert_record_relations(
240
- child,
241
- expected={
242
- "relations_extra_metadata": {
243
- "serial": [
244
- {
245
- "pid_value": parent_pid_value,
246
- "pid_type": parent_pid_type,
247
- "volume": "vol. 1",
248
- }
249
- ]
250
- },
251
- "relations": {
252
- "serial": [
253
- {
254
- "pid_value": parent_pid_value,
255
- "pid_type": parent_pid_type,
256
- "volume": "vol. 1",
257
- "relation_type": "serial",
258
- "record_metadata": {
259
- "title": parent["title"],
260
- "mode_of_issuance": parent["mode_of_issuance"],
261
- },
262
- }
263
- ]
264
- },
265
- },
266
- )
267
-
268
- def _test_delete_serial_to_mm(create_using_pid1=True):
269
- """Test relation delete of Serial and Multipart Monograph."""
270
-
271
- parent, child = recrel_choose_endpoints_and_do_request(
272
- (client, json_headers, "DELETE"),
273
- (
274
- parent_pid_value,
275
- parent_pid_type,
276
- child_pid_value,
277
- child_pid_type,
278
- ),
279
- payload,
280
- create_using_pid1=create_using_pid1,
281
- )
282
-
283
- recrel_assert_record_relations(parent, expected={"relations": {}})
284
- recrel_assert_record_relations(
285
- child,
286
- expected={
287
- "relations": {},
288
- },
289
- )
290
-
291
- _test_create_serial_to_mm()
292
- _test_delete_serial_to_mm()
293
- _test_create_serial_to_mm(create_using_pid1=False)
294
- _test_delete_serial_to_mm(create_using_pid1=False)
295
- # recreate for the next one, to have some more valuable test data
296
- _test_create_serial_to_mm()
297
-
298
-
299
- def _test_pc_serial_to_document(client, json_headers):
300
- """Test relation create/delete of Serial to Document."""
301
- parent_pid_value = "serid-3"
302
- parent_pid_type = "serid"
303
- child_pid_value = "docid-3"
304
- child_pid_type = "docid"
305
- relation_type = "serial"
306
-
307
- payload = {
308
- "parent_pid_value": parent_pid_value,
309
- "parent_pid_type": parent_pid_type,
310
- "child_pid_value": child_pid_value,
311
- "child_pid_type": child_pid_type,
312
- "relation_type": relation_type,
313
- "volume": "vol. 1",
314
- }
315
-
316
- def _test_create_serial_to_document(create_using_pid1=True):
317
- """Test relation create of Serial to Document."""
318
-
319
- parent, child = recrel_choose_endpoints_and_do_request(
320
- (client, json_headers, "POST"),
321
- (
322
- parent_pid_value,
323
- parent_pid_type,
324
- child_pid_value,
325
- child_pid_type,
326
- ),
327
- payload,
328
- create_using_pid1=create_using_pid1,
329
- )
330
-
331
- recrel_assert_record_relations(
332
- parent,
333
- expected={
334
- "relations": {},
335
- },
336
- )
337
-
338
- recrel_assert_record_relations(
339
- child,
340
- expected={
341
- "relations": {
342
- "serial": [
343
- {
344
- "pid_value": parent_pid_value,
345
- "pid_type": parent_pid_type,
346
- "volume": "vol. 1",
347
- "relation_type": "serial",
348
- "record_metadata": {
349
- "title": parent["title"],
350
- "mode_of_issuance": parent["mode_of_issuance"],
351
- },
352
- }
353
- ]
354
- },
355
- "relations_extra_metadata": {
356
- "serial": [
357
- {
358
- "pid_value": parent_pid_value,
359
- "pid_type": parent_pid_type,
360
- "volume": "vol. 1",
361
- },
362
- ]
363
- },
364
- },
365
- )
366
-
367
- def _test_delete_serial_to_document(create_using_pid1=True):
368
- """Test relation delete of Serial to Document."""
369
-
370
- parent, child = recrel_choose_endpoints_and_do_request(
371
- (client, json_headers, "DELETE"),
372
- (
373
- parent_pid_value,
374
- parent_pid_type,
375
- child_pid_value,
376
- child_pid_type,
377
- ),
378
- payload,
379
- create_using_pid1=create_using_pid1,
380
- )
381
-
382
- recrel_assert_record_relations(
383
- parent,
384
- expected={
385
- "relations": {},
386
- },
387
- )
388
- recrel_assert_record_relations(child, expected={"relations": {}})
389
-
390
- _test_create_serial_to_document()
391
- _test_delete_serial_to_document()
392
- _test_create_serial_to_document(create_using_pid1=False)
393
- _test_delete_serial_to_document(create_using_pid1=False)
394
- # recreate for the next one, to have some more valuable test data
395
- _test_create_serial_to_document()
396
-
397
-
398
- def _test_pc_invalid_relations_should_fail(
399
- client, json_headers, invalids, status_code=400
400
- ):
401
- """Test relation creation with invalid parent-child should fail."""
402
- api_endpoint_documents = "invenio_app_ils_relations.docid_relations"
403
- api_endpoint_series = "invenio_app_ils_relations.serid_relations"
404
-
405
- for invalid in invalids:
406
- parent_pid_value = invalid["parent_pid_value"]
407
- parent_pid_type = invalid["parent_pid_type"]
408
- child_pid_value = invalid["child_pid_value"]
409
- child_pid_type = invalid["child_pid_type"]
410
- relation_type = invalid["relation_type"]
411
-
412
- api_endpoint = (
413
- api_endpoint_documents
414
- if parent_pid_type == "docid"
415
- else api_endpoint_series
416
- )
417
-
418
- url = url_for(api_endpoint, pid_value=parent_pid_value)
419
- payload = {
420
- "parent_pid_value": parent_pid_value,
421
- "parent_pid_type": parent_pid_type,
422
- "child_pid_value": child_pid_value,
423
- "child_pid_type": child_pid_type,
424
- "relation_type": relation_type,
425
- }
426
-
427
- res = client.post(url, headers=json_headers, data=json.dumps(payload))
428
- assert res.status_code == status_code
429
- if status_code == 400:
430
- error = json.loads(res.data.decode("utf-8"))
431
- assert "message" in error
432
- assert parent_pid_value in error["message"]
433
- assert child_pid_value in error["message"]
434
-
435
-
436
- def test_parent_child_relations(client, json_headers, testdata, users):
437
- """Test parent child relations."""
438
-
439
- _test_pc_invalid_relations_should_fail(
440
- client,
441
- json_headers,
442
- [
443
- {
444
- "parent_pid_value": "serid-3",
445
- "parent_pid_type": "serid",
446
- "child_pid_value": "docid-1",
447
- "child_pid_type": "docid",
448
- "relation_type": "serial",
449
- }
450
- ],
451
- status_code=401,
452
- )
453
-
454
- user_login(client, "librarian", users)
455
-
456
- # only one test method to speed up tests and avoid testdata recreation at
457
- # each test. As drawback, testdata is not cleaned between each test, so
458
- # do not change the order of execution of the following tests :)
459
-
460
- # serid-1 [MM] -> docid-1
461
- _test_pc_mm_document(client, json_headers)
462
-
463
- # serid-1 [MM]
464
- # |
465
- # docid-1
466
-
467
- # serid-1 [MM] --- v.3 ---> docid-2
468
- _test_pc_mm_document_with_volume(client, json_headers)
469
-
470
- # serid-1 [MM]
471
- # |
472
- # / \ v.3
473
- # docid-1 docid-2
474
-
475
- # serid-3 [SERIAL] -> serid-1 [MM]
476
- _test_pc_serial_to_mm(client, json_headers)
477
-
478
- # serid-3 [SERIAL]
479
- # |
480
- # serid-1 [MM]
481
- # |
482
- # / \ v.3
483
- # docid-1 docid-2
484
-
485
- # serid-3 [SERIAL] -> docid-3
486
- _test_pc_serial_to_document(client, json_headers)
487
-
488
- # serid-3 [SERIAL]
489
- # |
490
- # / \
491
- # docid-3 serid-1 [MM]
492
- # |
493
- # / \ v.3
494
- # docid-1 docid-2
495
-
496
- # test wrong relations
497
- invalids = [
498
- {
499
- "parent_pid_value": "docid-1",
500
- "parent_pid_type": "docid",
501
- "child_pid_value": "serid-1", # Multipart Monograph
502
- "child_pid_type": "serid",
503
- "relation_type": "multipart_monograph",
504
- },
505
- {
506
- "parent_pid_value": "docid-1",
507
- "parent_pid_type": "docid",
508
- "child_pid_value": "serid-3", # Serial
509
- "child_pid_type": "serid",
510
- "relation_type": "serial",
511
- },
512
- {
513
- "parent_pid_value": "serid-1", # Multipart Monograph
514
- "parent_pid_type": "serid",
515
- "child_pid_value": "serid-3", # Serial
516
- "child_pid_type": "serid",
517
- "relation_type": "multipart_monograph",
518
- },
519
- {
520
- "parent_pid_value": "docid-1",
521
- "parent_pid_type": "docid",
522
- "child_pid_value": "docid-2",
523
- "child_pid_type": "docid",
524
- "relation_type": "serial",
525
- },
526
- # already existing
527
- {
528
- "parent_pid_value": "serid-3", # Serial
529
- "parent_pid_type": "serid",
530
- "child_pid_value": "docid-3",
531
- "child_pid_type": "docid",
532
- "relation_type": "serial",
533
- },
534
- ]
535
- _test_pc_invalid_relations_should_fail(client, json_headers, invalids)
536
-
537
-
538
- def test_max_one_multipart(testdata):
539
- doc = testdata["documents"][0]
540
- series1 = testdata["series"][0]
541
- rr = RecordRelationsParentChild()
542
- res = rr.add(
543
- series1,
544
- doc,
545
- Relation.get_relation_by_name("multipart_monograph"),
546
- )
547
-
548
- assert res
549
-
550
- series2 = testdata["series"][1]
551
-
552
- with pytest.raises(RecordRelationsError) as error:
553
- rr = RecordRelationsParentChild()
554
- res = rr.add(
555
- series2,
556
- doc,
557
- "multipart_monograph",
558
- )
559
-
560
- assert isinstance(error.value, RecordRelationsError)