@@ -550,3 +550,185 @@ def test_restore_pid(
550
550
)
551
551
552
552
assert restored_rec ._obj .deletion_status == RecordDeletionStatusEnum .PUBLISHED
553
+
554
+
555
+ def test_full_record_register (
556
+ running_app ,
557
+ search_clear ,
558
+ full_record ,
559
+ superuser_identity ,
560
+ mock_datacite_client ,
561
+ ):
562
+ """Registers a PID for a full record."""
563
+ full_record ["pids" ] = {}
564
+
565
+ service = current_rdm_records .records_service
566
+ draft = service .create (superuser_identity , full_record )
567
+ draft = service .pids .create (superuser_identity , draft .id , "doi" )
568
+ doi = draft ["pids" ]["doi" ]["identifier" ]
569
+ provider = service .pids .pid_manager ._get_provider ("doi" , "datacite" )
570
+ pid = provider .get (pid_value = doi )
571
+ record = service .record_cls .publish (draft ._record )
572
+ record .pids = {pid .pid_type : {"identifier" : pid .pid_value , "provider" : "datacite" }}
573
+ record .metadata = draft ["metadata" ]
574
+ record .register ()
575
+ record .commit ()
576
+ assert pid .status == PIDStatus .NEW
577
+ pid .reserve ()
578
+ assert pid .status == PIDStatus .RESERVED
579
+ register_or_update_pid (recid = record ["id" ], scheme = "doi" )
580
+ assert pid .status == PIDStatus .REGISTERED
581
+
582
+ mock_datacite_client .api .public_doi .assert_has_calls (
583
+ [
584
+ mock .call (
585
+ metadata = {
586
+ "contributors" : [
587
+ {
588
+ "affiliation" : [
589
+ {
590
+ "affiliationIdentifier" : "https://ror.org/01ggx4157" ,
591
+ "affiliationIdentifierScheme" : "ROR" ,
592
+ "name" : "CERN" ,
593
+ }
594
+ ],
595
+ "contributorType" : "Other" ,
596
+ "familyName" : "Nielsen" ,
597
+ "givenName" : "Lars Holm" ,
598
+ "name" : "Nielsen, Lars Holm" ,
599
+ "nameIdentifiers" : [
600
+ {
601
+ "nameIdentifier" : "0000-0001-8135-3489" ,
602
+ "nameIdentifierScheme" : "ORCID" ,
603
+ }
604
+ ],
605
+ "nameType" : "Personal" ,
606
+ }
607
+ ],
608
+ "creators" : [
609
+ {
610
+ "affiliation" : [
611
+ {
612
+ "affiliationIdentifier" : "https://ror.org/01ggx4157" ,
613
+ "affiliationIdentifierScheme" : "ROR" ,
614
+ "name" : "CERN" ,
615
+ },
616
+ {"name" : "free-text" },
617
+ ],
618
+ "familyName" : "Nielsen" ,
619
+ "givenName" : "Lars Holm" ,
620
+ "name" : "Nielsen, Lars Holm" ,
621
+ "nameIdentifiers" : [
622
+ {
623
+ "nameIdentifier" : "0000-0001-8135-3489" ,
624
+ "nameIdentifierScheme" : "ORCID" ,
625
+ }
626
+ ],
627
+ "nameType" : "Personal" ,
628
+ }
629
+ ],
630
+ "dates" : [
631
+ {"date" : "2018/2020-09" , "dateType" : "Issued" },
632
+ {
633
+ "date" : "1939/1945" ,
634
+ "dateInformation" : "A date" ,
635
+ "dateType" : "Other" ,
636
+ },
637
+ ],
638
+ "descriptions" : [
639
+ {
640
+ "description" : "A description \n with HTML tags" ,
641
+ "descriptionType" : "Abstract" ,
642
+ },
643
+ {
644
+ "description" : "Bla bla bla" ,
645
+ "descriptionType" : "Methods" ,
646
+ "lang" : "eng" ,
647
+ },
648
+ ],
649
+ "formats" : ["application/pdf" ],
650
+ "fundingReferences" : [
651
+ {
652
+ "awardNumber" : "755021" ,
653
+ "awardTitle" : "Personalised Treatment For "
654
+ "Cystic Fibrosis Patients "
655
+ "With Ultra-rare CFTR "
656
+ "Mutations (and beyond)" ,
657
+ "awardURI" : "https://cordis.europa.eu/project/id/755021" ,
658
+ "funderIdentifier" : "00k4n6c32" ,
659
+ "funderIdentifierType" : "ROR" ,
660
+ "funderName" : "European Commission" ,
661
+ }
662
+ ],
663
+ "geoLocations" : [
664
+ {
665
+ "geoLocationPlace" : "test location place" ,
666
+ "geoLocationPoint" : {
667
+ "pointLatitude" : "-60.63932" ,
668
+ "pointLongitude" : "-32.94682" ,
669
+ },
670
+ }
671
+ ],
672
+ "identifiers" : [
673
+ {
674
+ "identifier" : doi ,
675
+ "identifierType" : "DOI" ,
676
+ },
677
+ {
678
+ "identifier" : "1924MNRAS..84..308E" ,
679
+ "identifierType" : "bibcode" ,
680
+ },
681
+ ],
682
+ "language" : "dan" ,
683
+ "publicationYear" : "2018" ,
684
+ "publisher" : "InvenioRDM" ,
685
+ "relatedIdentifiers" : [
686
+ {
687
+ "relatedIdentifier" : "10.1234/foo.bar" ,
688
+ "relatedIdentifierType" : "DOI" ,
689
+ "relationType" : "IsCitedBy" ,
690
+ "resourceTypeGeneral" : "Dataset" ,
691
+ }
692
+ ],
693
+ "rightsList" : [
694
+ {
695
+ "rights" : "A custom license" ,
696
+ "rightsUri" : "https://customlicense.org/licenses/by/4.0/" ,
697
+ },
698
+ {
699
+ "rights" : "Creative Commons Attribution 4.0 "
700
+ "International" ,
701
+ "rightsIdentifier" : "cc-by-4.0" ,
702
+ "rightsIdentifierScheme" : "spdx" ,
703
+ "rightsUri" : "https://creativecommons.org/licenses/by/4.0/legalcode" ,
704
+ },
705
+ ],
706
+ "schemaVersion" : "http://datacite.org/schema/kernel-4" ,
707
+ "sizes" : ["11 pages" ],
708
+ "subjects" : [
709
+ {
710
+ "subject" : "Abdominal Injuries" ,
711
+ "subjectScheme" : "MeSH" ,
712
+ "valueURI" : "http://id.nlm.nih.gov/mesh/A-D000007" ,
713
+ },
714
+ {"subject" : "custom" },
715
+ ],
716
+ "titles" : [
717
+ {"title" : "InvenioRDM" },
718
+ {
719
+ "lang" : "eng" ,
720
+ "title" : "a research data management platform" ,
721
+ "titleType" : "Subtitle" ,
722
+ },
723
+ ],
724
+ "types" : {
725
+ "resourceType" : "Photo" ,
726
+ "resourceTypeGeneral" : "Image" ,
727
+ },
728
+ "version" : "v1.0" ,
729
+ },
730
+ url = f"https://127.0.0.1:5000/doi/{ doi } " ,
731
+ doi = doi ,
732
+ )
733
+ ]
734
+ )
0 commit comments