2626 TEST_MINIMAL_EXPERIMENT_RESPONSE ,
2727 TEST_ORCID_ID ,
2828 TEST_PUBMED_IDENTIFIER ,
29+ TEST_PUBMED_URL_IDENTIFIER ,
2930 TEST_USER ,
3031)
3132from tests .helpers .dependency_overrider import DependencyOverrider
@@ -712,6 +713,7 @@ def test_required_fields(client, setup_router_db, test_field):
712713def test_create_experiment_with_new_primary_pubmed_publication (client , setup_router_db , mock_publication_fetch ):
713714 mocked_publication = mock_publication_fetch
714715 response_data = create_experiment (client , {"primaryPublicationIdentifiers" : [mocked_publication ]})
716+ print (response_data )
715717
716718 assert len (response_data ["primaryPublicationIdentifiers" ]) == 1
717719 assert sorted (response_data ["primaryPublicationIdentifiers" ][0 ]) == sorted (
@@ -730,7 +732,37 @@ def test_create_experiment_with_new_primary_pubmed_publication(client, setup_rou
730732 "publicationYear" ,
731733 ]
732734 )
733- # TODO: add separate tests for generating the publication url and referenceHtml
735+
736+
737+ @pytest .mark .parametrize (
738+ "mock_publication_fetch" ,
739+ [({"dbName" : "PubMed" , "identifier" : f"{ TEST_PUBMED_URL_IDENTIFIER } " })],
740+ indirect = ["mock_publication_fetch" ],
741+ )
742+ def test_create_experiment_with_new_primary_pubmed_url_publication (client , setup_router_db , mock_publication_fetch ):
743+ mocked_publication = mock_publication_fetch
744+ response_data = create_experiment (client , {"primaryPublicationIdentifiers" : [mocked_publication ]})
745+ print (response_data )
746+
747+ assert len (response_data ["primaryPublicationIdentifiers" ]) == 1
748+ assert sorted (response_data ["primaryPublicationIdentifiers" ][0 ]) == sorted (
749+ [
750+ "abstract" ,
751+ "id" ,
752+ "authors" ,
753+ "dbName" ,
754+ "doi" ,
755+ "identifier" ,
756+ "title" ,
757+ "url" ,
758+ "recordType" ,
759+ "referenceHtml" ,
760+ "publicationJournal" ,
761+ "publicationYear" ,
762+ ]
763+ )
764+ assert response_data ["primaryPublicationIdentifiers" ][0 ]["identifier" ] == '37162834'
765+
734766
735767
736768@pytest .mark .parametrize (
0 commit comments