use of io.restassured.specification.RequestSpecification in project devonfw-testing by devonfw.
the class TokenValidTest method testNoneAlgorithmToken.
@Test
public void testNoneAlgorithmToken() {
Headers authHeaders = getSessionManager().getAuthHeaders(SessionEnum.WAITER);
String validToken = authHeaders.getValue(AUTH_HEADER);
String invalidToken = generateNoneAlgToken(validToken);
RequestSpecification rs = new RequestSpecBuilder().addHeader(AUTH_HEADER, invalidToken).setBaseUri(EnvironmentParam.SECURITY_SERVER_ORIGIN.getValue()).setBasePath(SubUrlEnum.ORDER_SEARCH.getValue()).addHeader("Content-Type", "application/json").setBody("{\"pagination\":{\"size\":8,\"page\":1,\"total\":1},\"sort\":[]}").build();
given(rs).when().post().then().statusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
}
use of io.restassured.specification.RequestSpecification in project devonfw-testing by devonfw.
the class CacheControlTest method testHeader.
@Test
@Parameters(method = "addParameters")
public void testHeader(SessionEnum session, EnvironmentParam origin, SubUrlEnum path, Method method, String contentType, String body, int statusCode) {
RequestSpecification rs = getSessionManager().initBuilder(session).setBaseUri(origin.getValue()).setBasePath(path.getValue()).setBody(body).addHeader("content-type", contentType).build();
given(rs).when().request(method).then().statusCode(statusCode).header("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate").header("Pragma", "no-cache").header("Expires", "0");
}
use of io.restassured.specification.RequestSpecification in project devonfw-testing by devonfw.
the class XContentTypeOptionsTest method testHeader.
@Test
@Parameters(method = "addParameters")
public void testHeader(SessionEnum session, EnvironmentParam origin, SubUrlEnum path) {
RequestSpecification rs = getSessionManager().initBuilder(session).setBaseUri(origin.getValue()).setBasePath(path.getValue()).build();
given(rs).when().get().then().statusCode(200).header("X-Content-Type-Options", "nosniff");
}
use of io.restassured.specification.RequestSpecification in project spring-cloud-netflix by spring-cloud.
the class AbstractDocumentationTests method document.
protected RequestSpecification document(String name, Object body) {
RestDocumentationFilter filter = filter(name);
RequestSpecification assured = RestAssured.given(spec(body, filter));
return assured.filter(filter);
}
use of io.restassured.specification.RequestSpecification in project vertigo by KleeGroup.
the class WebServiceManagerTest method doPaginedSearch.
private String doPaginedSearch(final Map<String, Object> criteriaContact, final Integer top, final Integer skip, final String sortFieldName, final Boolean sortDesc, final String listServerToken, final int expectedSize, final String firstContactName, final String lastContactName, final boolean isAuto) {
final RequestSpecification given = given().filter(loggedSessionFilter);
final String wsUrl = isAuto ? "/test/_searchAutoPagined" : "/test/_searchQueryPagined";
if (top != null) {
given.queryParam("top", top);
}
if (skip != null) {
given.queryParam("skip", skip);
}
if (sortFieldName != null) {
given.queryParam("sortFieldName", sortFieldName);
}
if (sortDesc != null) {
given.queryParam("sortDesc", sortDesc);
}
if (listServerToken != null) {
given.queryParam("listServerToken", listServerToken);
}
ResponseSpecification responseSpecification = given.body(criteriaContact).expect().body("size()", Matchers.equalTo(expectedSize));
if (expectedSize > 0) {
responseSpecification = responseSpecification.body("get(0).name", Matchers.equalTo(firstContactName)).body("get(" + (expectedSize - 1) + ").name", Matchers.equalTo(lastContactName));
}
final String newListServerToken = responseSpecification.statusCode(HttpStatus.SC_OK).when().post(wsUrl).header("listServerToken");
return newListServerToken;
}
Aggregations