Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Dec 11, 2024
1 parent 36550bd commit eabc951
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1159,4 +1159,20 @@ private void assertAllPublicButEmails(Person p) {
assertEquals(Long.valueOf(13), ru.getResearcherUrls().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, ru.getResearcherUrls().get(0).getVisibility());
}

@Test
public void viewNonProfessionalEmailsOnRecord() {
String orcid = "0000-0000-0000-0001";
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewRecord(orcid);
Record record = (Record) r.getEntity();
assertNotNull(record);
assertNotNull(record.getPerson());
assertNotNull(record.getPerson().getEmails());
assertEquals(1, record.getPerson().getEmails().getEmails().size());
Email e = record.getPerson().getEmails().getEmails().get(0);
assertTrue(e.isVerified());
assertEquals("APP-5555555555555555", e.getSource().retrieveSourcePath());
assertEquals("Source Client 1", e.getSource().getSourceName().getContent());
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package org.orcid.api.memberV3.server.delegator;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -78,6 +72,8 @@
import org.orcid.test.helper.v3.Utils;
import org.springframework.test.context.ContextConfiguration;

import static org.junit.Assert.*;

@RunWith(OrcidJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:test-orcid-api-web-context.xml" })
public class MemberV3ApiServiceDelegator_ReadRecordTest extends DBUnitTest {
Expand Down Expand Up @@ -1350,4 +1346,20 @@ private void assertAllPublicButEmails(Person p) {
assertEquals(Long.valueOf(13), ru.getResearcherUrls().get(0).getPutCode());
assertEquals(Visibility.PUBLIC, ru.getResearcherUrls().get(0).getVisibility());
}

@Test
public void viewNonProfessionalEmailsOnRecord() {
String orcid = "0000-0000-0000-0001";
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewRecord(orcid);
Record record = (Record) r.getEntity();
assertNotNull(record);
assertNotNull(record.getPerson());
assertNotNull(record.getPerson().getEmails());
assertEquals(1, record.getPerson().getEmails().getEmails().size());
Email e = record.getPerson().getEmails().getEmails().get(0);
assertTrue(e.isVerified());
assertEquals("APP-5555555555555555", e.getSource().retrieveSourcePath());
assertEquals("Source Client 1", e.getSource().getSourceName().getContent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1534,5 +1534,20 @@ public void testSchemaOrgMBWriterV2() throws WebApplicationException, IOExceptio
assertEquals("self_public_user_obo_type",doc.identifier.get(0).propertyID);
assertEquals( "self_public_user_obo_ref",doc.identifier.get(0).value);
}


@Test
public void viewNonProfessionalEmailsOnRecord() {
String orcid = "0000-0000-0000-0001";
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewRecord(orcid);
Record record = (Record) r.getEntity();
assertNotNull(record);
assertNotNull(record.getPerson());
assertNotNull(record.getPerson().getEmails());
assertEquals(1, record.getPerson().getEmails().getEmails().size());
Email e = record.getPerson().getEmails().getEmails().get(0);
assertTrue(e.isVerified());

Check failure on line 1549 in orcid-pub-web/src/test/java/org/orcid/api/publicV2/server/PublicV2ApiServiceDelegatorTest.java

View workflow job for this annotation

GitHub Actions / Unit test report for orcid-pub-web

org.orcid.api.publicV2.server.PublicV2ApiServiceDelegatorTest ► viewNonProfessionalEmailsOnRecord

Failed test found in: orcid-pub-web/target/surefire-reports/TEST-org.orcid.api.publicV2.server.PublicV2ApiServiceDelegatorTest.xml Error: java.lang.AssertionError
Raw output
java.lang.AssertionError
	at org.orcid.api.publicV2.server.PublicV2ApiServiceDelegatorTest.viewNonProfessionalEmailsOnRecord(PublicV2ApiServiceDelegatorTest.java:1549)
assertEquals("APP-5555555555555555", e.getSource().retrieveSourcePath());
assertEquals("Source Client 1", e.getSource().getSourceName().getContent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2187,4 +2187,20 @@ public void testExpandedSearchByQueryNoRowsParamSet() {

ReflectionTestUtils.setField(serviceDelegator, "orcidSearchManager", orcidSearchManager);
}

@Test
public void viewNonProfessionalEmailsOnRecord() {
String orcid = "0000-0000-0000-0001";
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewRecord(orcid);
Record record = (Record) r.getEntity();
assertNotNull(record);
assertNotNull(record.getPerson());
assertNotNull(record.getPerson().getEmails());
assertEquals(1, record.getPerson().getEmails().getEmails().size());
Email e = record.getPerson().getEmails().getEmails().get(0);
assertTrue(e.isVerified());

Check failure on line 2202 in orcid-pub-web/src/test/java/org/orcid/api/publicV3/server/PublicV3ApiServiceDelegatorTest.java

View workflow job for this annotation

GitHub Actions / Unit test report for orcid-pub-web

org.orcid.api.publicV3.server.PublicV3ApiServiceDelegatorTest ► viewNonProfessionalEmailsOnRecord

Failed test found in: orcid-pub-web/target/surefire-reports/TEST-org.orcid.api.publicV3.server.PublicV3ApiServiceDelegatorTest.xml Error: java.lang.AssertionError
Raw output
java.lang.AssertionError
	at org.orcid.api.publicV3.server.PublicV3ApiServiceDelegatorTest.viewNonProfessionalEmailsOnRecord(PublicV3ApiServiceDelegatorTest.java:2202)
assertEquals("APP-5555555555555555", e.getSource().retrieveSourcePath());
assertEquals("Source Client 1", e.getSource().getSourceName().getContent());
}
}

0 comments on commit eabc951

Please sign in to comment.