2018-08-03 09:38:13 +02:00
|
|
|
package sonia.scm.it;
|
|
|
|
|
|
|
|
|
|
import io.restassured.RestAssured;
|
|
|
|
|
import io.restassured.specification.RequestSpecification;
|
|
|
|
|
|
|
|
|
|
import java.net.URI;
|
|
|
|
|
|
2018-08-06 11:53:45 +02:00
|
|
|
import static java.net.URI.create;
|
2018-08-03 09:38:13 +02:00
|
|
|
|
|
|
|
|
public class RestUtil {
|
|
|
|
|
|
2018-08-06 11:53:45 +02:00
|
|
|
public static final URI BASE_URL = create("http://localhost:8081/scm/");
|
|
|
|
|
public static final URI REST_BASE_URL = BASE_URL.resolve("api/rest/v2/");
|
2018-08-03 09:38:13 +02:00
|
|
|
|
2018-08-06 11:53:45 +02:00
|
|
|
public static URI createResourceUrl(String path) {
|
|
|
|
|
return REST_BASE_URL.resolve(path);
|
2018-08-03 09:38:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static RequestSpecification given(String mediaType) {
|
2018-08-06 11:53:45 +02:00
|
|
|
return RestAssured.given()
|
2018-08-03 09:38:13 +02:00
|
|
|
.contentType(mediaType)
|
|
|
|
|
.accept(mediaType)
|
|
|
|
|
.auth().preemptive().basic("scmadmin", "scmadmin");
|
|
|
|
|
}
|
|
|
|
|
}
|