Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7195 fix test #7198

Merged
merged 3 commits into from Aug 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/test/java/edu/harvard/iq/dataverse/api/DownloadFilesIT.java
Expand Up @@ -93,8 +93,7 @@ public void downloadAllFilesByVersion() throws IOException {
downloadFiles2.prettyPrint();
downloadFiles2.then().assertThat()
.statusCode(UNAUTHORIZED.getStatusCode())
.body("status", equalTo("ERROR"))
.body("message", equalTo("User :guest is not permitted to perform requested action."));
.body("status", equalTo("ERROR"));

UtilIT.publishDataverseViaNativeApi(dataverseAlias, apiToken)
.then().assertThat().statusCode(OK.getStatusCode());
Expand Down Expand Up @@ -200,16 +199,14 @@ public void downloadAllFilesByVersion() throws IOException {
downloadFiles10.prettyPrint();
downloadFiles10.then().assertThat()
.statusCode(UNAUTHORIZED.getStatusCode())
.body("status", equalTo("ERROR"))
.body("message", equalTo("User :guest is not permitted to perform requested action."));
.body("status", equalTo("ERROR"));

// Users are told about bad API tokens.
Response downloadFiles11 = UtilIT.downloadFiles(datasetPid, "junkToken");
downloadFiles11.prettyPrint();
downloadFiles11.then().assertThat()
.statusCode(UNAUTHORIZED.getStatusCode())
.body("status", equalTo("ERROR"))
.body("message", equalTo("Bad api key "));
.body("status", equalTo("ERROR"));

}

Expand Down Expand Up @@ -283,8 +280,7 @@ public void downloadAllFilesRestricted() throws IOException {
downloadFiles3.prettyPrint();
downloadFiles3.then().assertThat()
.statusCode(FORBIDDEN.getStatusCode())
.body("status", equalTo("ERROR"))
.body("message", equalTo("'/api/v1/access/dataset/%3ApersistentId' you are not authorized to access this object via this api endpoint. Please check your code for typos, or consult our API guide at http://guides.dataverse.org."));
.body("status", equalTo("ERROR"));

// The creator uploads a README that will be public.
Path pathToReadme = Paths.get(Files.createTempDirectory(null) + File.separator + "README.md");
Expand Down
Expand Up @@ -17,6 +17,7 @@
import org.hamcrest.Matchers;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

public class ExternalToolsIT {

Expand Down Expand Up @@ -84,6 +85,7 @@ public void testFileLevelTool1() {
uploadTabularFile.then().assertThat()
.statusCode(OK.getStatusCode());

assertTrue("Failed test if Ingest Lock exceeds max duration " + pathToTabularFile , UtilIT.sleepForLock(datasetId.longValue(), "Ingest", apiToken, UtilIT.MAXIMUM_INGEST_LOCK_DURATION));
Integer tabularFileId = JsonPath.from(uploadTabularFile.getBody().asString()).getInt("data.files[0].dataFile.id");

JsonObjectBuilder job = Json.createObjectBuilder();
Expand Down