Search in sources :

Example 11 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project nakadi by zalando.

the class RealEnvironmentAT method requestSpec.

protected RequestSpecification requestSpec() {
    final RequestSpecification requestSpec = given();
    oauthToken.ifPresent(token -> requestSpec.header("Authorization", "Bearer " + token));
    return requestSpec;
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification)

Example 12 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project camunda-bpm-platform by camunda.

the class TenantRestServiceQueryTest method completeGetParameters.

@Test
public void completeGetParameters() {
    Map<String, String> queryParameters = getCompleteStringQueryParameters();
    RequestSpecification requestSpecification = given().contentType(POST_JSON_CONTENT_TYPE);
    for (Entry<String, String> paramEntry : queryParameters.entrySet()) {
        requestSpecification.parameter(paramEntry.getKey(), paramEntry.getValue());
    }
    requestSpecification.expect().statusCode(Status.OK.getStatusCode()).when().get(QUERY_URL);
    verify(mockQuery).tenantId(MockProvider.EXAMPLE_TENANT_ID);
    verify(mockQuery).tenantName(MockProvider.EXAMPLE_TENANT_NAME);
    verify(mockQuery).tenantNameLike("%" + MockProvider.EXAMPLE_TENANT_NAME + "%");
    verify(mockQuery).userMember(MockProvider.EXAMPLE_USER_ID);
    verify(mockQuery).groupMember(MockProvider.EXAMPLE_GROUP_ID);
    verify(mockQuery).list();
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification) Test(org.junit.Test)

Example 13 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project structr by structr.

the class RestCommand method request.

protected RequestSpecification request(final Console console) {
    final RequestSpecification req = RestAssured.given();
    final String usernameFromAuth = console.getUsername();
    final String passwordFromAuth = console.getPassword();
    req.accept(ContentType.JSON);
    if (StringUtils.isNoneBlank(username, password)) {
        req.header("X-User", username);
        req.header("X-Password", password);
    } else if (StringUtils.isNoneBlank(usernameFromAuth, passwordFromAuth)) {
        req.header("X-User", usernameFromAuth);
        req.header("X-Password", passwordFromAuth);
    }
    return req;
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification)

Aggregations

RequestSpecification (com.jayway.restassured.specification.RequestSpecification)13 Test (org.junit.Test)4 Response (com.jayway.restassured.response.Response)2 IOException (java.io.IOException)1 Authorization (org.camunda.bpm.engine.authorization.Authorization)1 AuthorizationQuery (org.camunda.bpm.engine.authorization.AuthorizationQuery)1 PreparationMessage (org.talend.dataprep.api.preparation.PreparationMessage)1 TDPException (org.talend.dataprep.exception.TDPException)1 MockTDPException (org.talend.dataprep.test.MockTDPException)1