mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
Adapt integration test to new HAL link name for children
This commit is contained in:
@@ -201,7 +201,7 @@ public class RepositoryAccessITCase {
|
|||||||
.then()
|
.then()
|
||||||
.statusCode(HttpStatus.SC_OK)
|
.statusCode(HttpStatus.SC_OK)
|
||||||
.extract()
|
.extract()
|
||||||
.path("_embedded.files.find{it.name=='a.txt'}._links.self.href");
|
.path("_embedded.children.find{it.name=='a.txt'}._links.self.href");
|
||||||
|
|
||||||
given()
|
given()
|
||||||
.when()
|
.when()
|
||||||
@@ -216,7 +216,7 @@ public class RepositoryAccessITCase {
|
|||||||
.then()
|
.then()
|
||||||
.statusCode(HttpStatus.SC_OK)
|
.statusCode(HttpStatus.SC_OK)
|
||||||
.extract()
|
.extract()
|
||||||
.path("_embedded.files.find{it.name=='subfolder'}._links.self.href");
|
.path("_embedded.children.find{it.name=='subfolder'}._links.self.href");
|
||||||
String selfOfSubfolderUrl = given()
|
String selfOfSubfolderUrl = given()
|
||||||
.when()
|
.when()
|
||||||
.get(subfolderSourceUrl)
|
.get(subfolderSourceUrl)
|
||||||
@@ -231,7 +231,7 @@ public class RepositoryAccessITCase {
|
|||||||
.then()
|
.then()
|
||||||
.statusCode(HttpStatus.SC_OK)
|
.statusCode(HttpStatus.SC_OK)
|
||||||
.extract()
|
.extract()
|
||||||
.path("_embedded.files[0]._links.self.href");
|
.path("_embedded.children[0]._links.self.href");
|
||||||
given()
|
given()
|
||||||
.when()
|
.when()
|
||||||
.get(subfolderContentUrl)
|
.get(subfolderContentUrl)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package sonia.scm.it.utils;
|
|||||||
|
|
||||||
import io.restassured.RestAssured;
|
import io.restassured.RestAssured;
|
||||||
import io.restassured.response.Response;
|
import io.restassured.response.Response;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import sonia.scm.web.VndMediaType;
|
import sonia.scm.web.VndMediaType;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@@ -25,6 +27,8 @@ import static sonia.scm.it.utils.TestData.createPasswordChangeJson;
|
|||||||
*/
|
*/
|
||||||
public class ScmRequests {
|
public class ScmRequests {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ScmRequests.class);
|
||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
private String username;
|
private String username;
|
||||||
private String password;
|
private String password;
|
||||||
@@ -46,10 +50,12 @@ public class ScmRequests {
|
|||||||
* @return the response of the GET request using the given link
|
* @return the response of the GET request using the given link
|
||||||
*/
|
*/
|
||||||
private Response applyGETRequestFromLink(Response response, String linkPropertyName) {
|
private Response applyGETRequestFromLink(Response response, String linkPropertyName) {
|
||||||
return applyGETRequest(response
|
String result = response
|
||||||
.then()
|
.then()
|
||||||
.extract()
|
.extract()
|
||||||
.path(linkPropertyName));
|
.path(linkPropertyName);
|
||||||
|
LOG.info("Extracted result {} from response: {}", linkPropertyName, result);
|
||||||
|
return applyGETRequest(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,24 +273,12 @@ public class ScmRequests {
|
|||||||
this.sourcesResponse = sourcesResponse;
|
this.sourcesResponse = sourcesResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SourcesResponse assertRevision(Consumer<String> assertRevision) {
|
|
||||||
String revision = sourcesResponse.then().extract().path("revision");
|
|
||||||
assertRevision.accept(revision);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SourcesResponse assertFiles(Consumer<List> assertFiles) {
|
|
||||||
List files = sourcesResponse.then().extract().path("files");
|
|
||||||
assertFiles.accept(files);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppliedChangesetsRequest requestFileHistory(String fileName) {
|
public AppliedChangesetsRequest requestFileHistory(String fileName) {
|
||||||
return new AppliedChangesetsRequest(applyGETRequestFromLink(sourcesResponse, "_embedded.files.find{it.name=='" + fileName + "'}._links.history.href"));
|
return new AppliedChangesetsRequest(applyGETRequestFromLink(sourcesResponse, "_embedded.children.find{it.name=='" + fileName + "'}._links.history.href"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppliedSourcesRequest requestSelf(String fileName) {
|
public AppliedSourcesRequest requestSelf(String fileName) {
|
||||||
return new AppliedSourcesRequest(applyGETRequestFromLink(sourcesResponse, "_embedded.files.find{it.name=='" + fileName + "'}._links.self.href"));
|
return new AppliedSourcesRequest(applyGETRequestFromLink(sourcesResponse, "_embedded.children.find{it.name=='" + fileName + "'}._links.self.href"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user