Skip to content

Commit

Permalink
Add test case for public ORCID API endpoint to result in scope /authe…
Browse files Browse the repository at this point in the history
…nticate. IQSS#7025
  • Loading branch information
poikilotherm committed Jul 8, 2020
1 parent fc9e633 commit 12fe798
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import java.util.Arrays;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.ValueSource;

import static org.junit.jupiter.api.Assertions.*;

/**
Expand Down Expand Up @@ -41,6 +45,15 @@ private static String loadResponseXML(String fname) {
}
return txt;
}

@ParameterizedTest
@CsvSource({"https://pub.orcid.org/v2.1/{ORCID}/person,/authenticate", "https://api.orcid.org/v2.0/{ORCID}/person,/read-limited"})
public void testPublicApiScope(String endpoint, String scope) {
// when
OrcidOAuth2AP provider = new OrcidOAuth2AP("clientId", "clientSecret", endpoint);
// then
assertEquals(scope, provider.getSpacedScope());
}

@Test
public void testParseUserResponse() {
Expand Down

0 comments on commit 12fe798

Please sign in to comment.