本文整理汇总了Java中io.restassured.response.ValidatableResponse类的典型用法代码示例。如果您正苦于以下问题:Java ValidatableResponse类的具体用法?Java ValidatableResponse怎么用?Java ValidatableResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidatableResponse类属于io.restassured.response包,在下文中一共展示了ValidatableResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createResponseLog
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
private String createResponseLog(ValidatableResponse response) {
ExtractableResponse extractableResponse = response.extract();
StringBuilder builder = new StringBuilder();
builder.append("RESPONSE: ");
builder.append(extractableResponse.statusCode());
builder.append(" - Headers: ");
Headers headers = extractableResponse.headers();
Map<String, String> headerMap = new HashMap<>();
if (headers != null) {
headers.forEach((header) -> headerMap.put(header.getName(), header.getValue()));
}
builder.append(headerMap);
builder.append(NEW_LINE);
builder.append(extractableResponse.body().asString());
return builder.toString();
}
开发者ID:Atypon-OpenSource,项目名称:wayf-cloud,代码行数:21,代码来源:LoggingHttpRequestFactory.java
示例2: testOperationBookingResource
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testOperationBookingResource(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/bookings'.get.summary", equalTo("Retrieve all bookings for current user"));
vr.body("paths.'/bookings'.get.operationId", equalTo("getAllBookings"));
vr.body("paths.'/bookings'.post.summary", equalTo("Create a booking"));
vr.body("paths.'/bookings'.post.description", equalTo("Create a new booking record with the booking information provided."));
vr.body("paths.'/bookings'.post.operationId", equalTo("createBooking"));
vr.body("paths.'/bookings/{id}'.get.summary", equalTo("Get a booking with ID"));
vr.body("paths.'/bookings/{id}'.get.operationId", equalTo("getBookingById"));
vr.body("paths.'/bookings/{id}'.put.summary", equalTo("Update a booking with ID"));
vr.body("paths.'/bookings/{id}'.put.operationId", equalTo("updateBookingId"));
vr.body("paths.'/bookings/{id}'.delete.summary", equalTo("Delete a booking with ID"));
vr.body("paths.'/bookings/{id}'.delete.operationId", equalTo("deleteBookingById"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:21,代码来源:AirlinesAppTest.java
示例3: testOperationReviewResource
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testOperationReviewResource(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/reviews'.get.summary", equalTo("get all the reviews"));
vr.body("paths.'/reviews'.get.operationId", equalTo("getAllReviews"));
vr.body("paths.'/reviews'.post.summary", equalTo("Create a Review"));
vr.body("paths.'/reviews'.post.operationId", equalTo("createReview"));
vr.body("paths.'/reviews/{id}'.get.summary", equalTo("Get a review with ID"));
vr.body("paths.'/reviews/{id}'.get.operationId", equalTo("getReviewById"));
vr.body("paths.'/reviews/{id}'.delete.summary", equalTo("Delete a Review with ID"));
vr.body("paths.'/reviews/{id}'.delete.operationId", equalTo("deleteReview"));
vr.body("paths.'/reviews/{user}'.get.summary", equalTo("Get all reviews by user"));
vr.body("paths.'/reviews/{user}'.get.operationId", equalTo("getReviewByUser"));
vr.body("paths.'/reviews/{airline}'.get.summary", equalTo("Get all reviews by airlines"));
vr.body("paths.'/reviews/{airline}'.get.operationId", equalTo("getReviewByAirline"));
vr.body("paths.'/reviews/{user}/{airlines}'.get.summary", equalTo("Get all reviews for an airline by User"));
vr.body("paths.'/reviews/{user}/{airlines}'.get.operationId", equalTo("getReviewByAirlineAndUser"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:26,代码来源:AirlinesAppTest.java
示例4: testAPIResponse
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testAPIResponse(String type) {
ValidatableResponse vr = callEndpoint(type);
// @APIResponse at method level
vr.body("paths.'/availability'.get.responses", aMapWithSize(2));
vr.body("paths.'/availability'.get.responses.'200'.description", equalTo("successful operation"));
vr.body("paths.'/availability'.get.responses.'404'.description", equalTo("No available flights found"));
vr.body("paths.'/bookings'.post.responses", aMapWithSize(1));
vr.body("paths.'/bookings'.post.responses.'201'.description", equalTo("Booking created"));
vr.body("paths.'/user/{username}'.delete.responses", aMapWithSize(3));
vr.body("paths.'/user/{username}'.delete.responses.'200'.description", equalTo("User deleted successfully"));
vr.body("paths.'/user/{username}'.delete.responses.'400'.description", equalTo("Invalid username supplied"));
vr.body("paths.'/user/{username}'.delete.responses.'404'.description", equalTo("User not found"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:18,代码来源:AirlinesAppTest.java
示例5: testAPIResponses
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testAPIResponses(String type) {
ValidatableResponse vr = callEndpoint(type);
// @APIResponse annotations nested within @APIResponses
vr.body("paths.'/bookings/{id}'.get.responses", aMapWithSize(2));
vr.body("paths.'/bookings/{id}'.get.responses.'200'.description", equalTo("Booking retrieved"));
vr.body("paths.'/bookings/{id}'.get.responses.'404'.description", equalTo("Booking not found"));
vr.body("paths.'/reviews/{user}'.get.responses", aMapWithSize(2));
vr.body("paths.'/reviews/{user}'.get.responses.'200'.description", equalTo("Review(s) retrieved"));
vr.body("paths.'/reviews/{user}'.get.responses.'404'.description", equalTo("Review(s) not found"));
vr.body("paths.'/user/{username}'.put.responses", aMapWithSize(3));
vr.body("paths.'/user/{username}'.put.responses.'200'.description", equalTo("User updated successfully"));
vr.body("paths.'/user/{username}'.put.responses.'400'.description", equalTo("Invalid user supplied"));
vr.body("paths.'/user/{username}'.put.responses.'404'.description", equalTo("User not found"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:19,代码来源:AirlinesAppTest.java
示例6: testUserLoginMethods
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
private void testUserLoginMethods(ValidatableResponse vr) {
String reviewParameters = "paths.'/user/login'.get.parameters";
vr.body(reviewParameters, hasSize(2));
vr.body(reviewParameters + ".findAll { it }.name", hasItems("username", "password"));
List<String[]> list = new ArrayList<String[]>();
list.add(new String[] { "username", "The user name for login" });
list.add(new String[] { "password", "The password for login in clear text" });
for (int i = 0; i < list.size(); i++) {
String currentParam = list.get(i)[0];
String query = reviewParameters + ".findAll { it.name == '" + currentParam + "' }";
vr.body(query + ".in", both(hasSize(1)).and(contains("query")));
vr.body(query + ".description", both(hasSize(1)).and(contains(list.get(i)[1])));
vr.body(query + ".required", both(hasSize(1)).and(contains(true)));
vr.body(query + ".schema.type", both(hasSize(1)).and(contains("string")));
}
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:19,代码来源:AirlinesAppTest.java
示例7: testBookingIdMethods
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
private void testBookingIdMethods(ValidatableResponse vr) {
String bookingParameters = "paths.'/bookings/{id}'.%s.parameters";
for (String method : new String[] { "put", "delete", "get" }) {
bookingParameters = String.format(bookingParameters, method);
vr.body(bookingParameters, hasSize(1));
vr.body(bookingParameters + ".findAll { it }.name", contains("id"));
vr.body(bookingParameters + ".findAll { it.name == 'id' }.required", both(hasSize(1)).and(contains(true)));
vr.body(bookingParameters + ".findAll { it.name == 'id' }.schema.type", both(hasSize(1)).and(contains("integer")));
}
bookingParameters = "paths.'/bookings/{id}'.get.parameters";
vr.body(bookingParameters + ".findAll { it.name == 'id' }.style", both(hasSize(1)).and(contains("simple")));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:17,代码来源:AirlinesAppTest.java
示例8: testCallbackAnnotations
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testCallbackAnnotations(String type) {
ValidatableResponse vr = callEndpoint(type);
String endpoint = "paths.'/streams'.post.callbacks";
vr.body(endpoint, hasKey("onData"));
vr.body(endpoint + ".onData", hasKey("{$request.query.callbackUrl}/data"));
endpoint = "paths.'/reviews'.post.callbacks";
vr.body(endpoint, hasKey("testCallback"));
vr.body(endpoint + ".testCallback", hasKey("http://localhost:9080/oas3-airlines/reviews"));
endpoint = "paths.'/bookings'.post.callbacks";
vr.body(endpoint, hasKey("bookingCallback"));
vr.body(endpoint + ".'bookingCallback'", hasKey("http://localhost:9080/airlines/bookings"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:17,代码来源:AirlinesAppTest.java
示例9: testCallbackOperationAnnotations
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testCallbackOperationAnnotations(String type) {
ValidatableResponse vr = callEndpoint(type);
// TODO: cover /streams endpoint
String endpoint = "paths.'/bookings'.post.callbacks.'bookingCallback'.'http://localhost:9080/airlines/bookings'";
vr.body(endpoint, hasKey("get"));
vr.body(endpoint + ".get.summary", equalTo("Retrieve all bookings for current user"));
vr.body(endpoint + ".get.responses.'200'.description", equalTo("Bookings retrieved"));
vr.body(endpoint + "get.responses.'200'.content.'application/json'.type", equalTo("array"));
endpoint = "paths.'/reviews'.post.callbacks.testCallback.'http://localhost:9080/oas3-airlines/reviews'";
vr.body(endpoint, hasKey("get"));
vr.body(endpoint + ".get.summary", equalTo("Get all reviews"));
vr.body(endpoint + ".get.responses.'200'.description", equalTo("successful operation"));
vr.body(endpoint + ".get.responses.'200'.content.'application/json'.schema.ref", equalTo("#/components/schemas/Review"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:19,代码来源:AirlinesAppTest.java
示例10: testSecurityRequirement
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSecurityRequirement(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("security.airlinesRatingApp_auth[0][0]", equalTo(null));
vr.body("paths.'/reviews'.post.security.reviewoauth2[0][0]", equalTo("write:reviews"));
vr.body("paths.'/reviews'.post.security.reviewoauth2", hasSize(1));
vr.body("paths.'/bookings'.post.security.bookingSecurityScheme[0][0]", equalTo("write:bookings"));
vr.body("paths.'/bookings'.post.security.bookingSecurityScheme[0][1]", equalTo("read:bookings"));
vr.body("paths.'/reviews'.post.security.bookingSecurityScheme", hasSize(1));
vr.body("paths.'/bookings'.post.security.bookingSecurityScheme[0]", hasSize(2));
vr.body("paths.'/user'.post.security.httpSchemeForTest[0][0]", equalTo(null));
vr.body("paths.'/user/login'.get.security.find { it.httpTestScheme != null }.httpTestScheme", empty());
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:19,代码来源:AirlinesAppTest.java
示例11: testSecurityScheme
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSecurityScheme(String type) {
ValidatableResponse vr = callEndpoint(type);
String http = "components.securitySchemes.httpSchemeForTest.";
vr.body(http + "type", equalTo("http"));
vr.body(http + "description", equalTo("user security scheme"));
vr.body(http + "scheme", equalTo("testScheme"));
String booking = "components.securitySchemes.bookingSecurityScheme.";
vr.body(booking + "type", equalTo("openIdConnect"));
vr.body(booking + "description", equalTo("Security Scheme for booking resource"));
vr.body(booking + "openIdConnectUrl", equalTo("http://openidconnect.com/testurl"));
String auth = "components.securitySchemes.airlinesRatingApp_auth.";
vr.body(auth + "type", equalTo("apiKey"));
vr.body(auth + "description", equalTo("authentication needed to access Airlines app"));
vr.body(auth + "name", equalTo("api_key"));
vr.body(auth + "in", equalTo("header"));
String reviewoauth2 = "components.securitySchemes.reviewoauth2.";
vr.body(reviewoauth2 + "type", equalTo("oauth2"));
vr.body(reviewoauth2 + "description", equalTo("authentication needed to create and delete reviews"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:25,代码来源:AirlinesAppTest.java
示例12: testOAuthFlow
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testOAuthFlow(String type) {
ValidatableResponse vr = callEndpoint(type);
String implicit = "components.securitySchemes.reviewoauth2.flows.implicit.";
vr.body(implicit + "authorizationUrl", equalTo("https://example.com/api/oauth/dialog"));
String authCode = "components.securitySchemes.reviewoauth2.flows.authorizationCode.";
vr.body(authCode + "authorizationUrl", equalTo("https://example.com/api/oauth/dialog"));
vr.body(authCode + "tokenUrl", equalTo("https://example.com/api/oauth/token"));
String password = "components.securitySchemes.reviewoauth2.flows.password.";
vr.body(password + "refreshUrl", equalTo("https://example.com/api/oauth/refresh"));
String client = "components.securitySchemes.reviewoauth2.flows.clientCredentials.";
vr.body(client + "tokenUrl", equalTo("https://example.com/api/oauth/token"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:18,代码来源:AirlinesAppTest.java
示例13: testEncodingResponses
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testEncodingResponses(String type) {
ValidatableResponse vr = callEndpoint(type);
String s = "paths.'/user/{username}'.put.responses.'200'.content.'application/json'.encoding.password.";
vr.body(s + "contentType", equalTo("text/plain"));
vr.body(s + "style", equalTo("form"));
vr.body(s + "explode", equalTo(true));
vr.body(s + "allowReserved", equalTo(true));
String t = "paths.'/user/{username}'.put.responses.'200'.content.'application/xml'.encoding.password.";
vr.body(t + "contentType", equalTo("text/plain"));
vr.body(t + "style", equalTo("form"));
vr.body(t + "explode", equalTo(true));
vr.body(t + "allowReserved", equalTo(true));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:17,代码来源:AirlinesAppTest.java
示例14: testLink
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testLink(String type) {
ValidatableResponse vr = callEndpoint(type);
String s = "paths.'/user/{id}'.get.responses.'200'.links.'User name'.";
vr.body(s + "operationId", equalTo("getUserByName"));
vr.body(s + "description", equalTo("The username corresponding to provided user id"));
String t = "paths.'/user/{id}'.get.responses.'200'.links.Review.";
vr.body(t + "operationRef", equalTo("/db/reviews/{userName}"));
vr.body(t + "description", equalTo("The reviews provided by user"));
String k = "paths.'/reviews'.post.responses.'201'.links.Review.";
vr.body(k + "operationId", equalTo("getReviewById"));
vr.body(k + "description", equalTo("get the review that was added"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:17,代码来源:AirlinesAppTest.java
示例15: testSchema
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSchema(String type) {
ValidatableResponse vr = callEndpoint(type);
String createSchema = "paths.'/user/createWithArray'.post.parameters.find{ it.name == 'userArray' }.content.'application/json'.schema";
// Basic properties
vr.body("components.schemas.AirlinesRef.$ref", equalTo("#/components/schemas/Airlines"));
vr.body("components.schemas.Airlines.title", equalTo("Airlines"));
vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.type", equalTo("string"));
vr.body("components.schemas.id.format", equalTo("int32"));
vr.body("paths.'/bookings'.post.responses.'201'.content.'application/json'.schema.description", equalTo("id of the new booking"));
vr.body("components.schemas.User.properties.password.example", equalTo("bobSm37"));
vr.body(createSchema + ".nullable", equalTo(true));
vr.body(createSchema + ".writeOnly", equalTo(true));
// Object properties
vr.body("paths.'/user'.post.requestBody.content.'application/json'.schema.maxProperties", equalTo(1024));
vr.body("paths.'/user'.post.requestBody.content.'application/json'.schema.minProperties", equalTo(1));
vr.body("components.schemas.User.required", hasItems("id", "username", "password")); // requiredProperties
// Array properties
vr.body(createSchema + ".maxItems", equalTo(20));
vr.body(createSchema + ".minItems", equalTo(2));
vr.body(createSchema + ".uniqueItems", equalTo(true));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:27,代码来源:AirlinesAppTest.java
示例16: testTagDeclarations
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testTagDeclarations(String type) {
ValidatableResponse vr = callEndpoint(type);
String tagsPath = "tags.find { it.name == '";
String desc = "' }.description";
vr.body(tagsPath + "user" + desc, equalTo("Operations about user"));
vr.body(tagsPath + "create" + desc, equalTo("Operations about create"));
vr.body(tagsPath + "Airlines" + desc, equalTo("All the airlines methods"));
vr.body(tagsPath + "Availability" + desc, equalTo("All the availability methods"));
vr.body(tagsPath + "Get Flights" + desc, equalTo("method to retrieve all flights available"));
vr.body(tagsPath + "Get Flights" + "' }.externalDocs.description", equalTo("A list of all the flights offered by the app"));
vr.body(tagsPath + "Get Flights" + "' }.externalDocs.url", equalTo("http://airlinesratingapp.com/ourflights"));
vr.body(tagsPath + "Bookings" + desc, equalTo("All the bookings methods"));
vr.body(tagsPath + "Reservations" + desc, equalTo("All the reservation methods"));
vr.body(tagsPath + "Reviews" + desc, equalTo("All the review methods"));
vr.body(tagsPath + "Ratings" + desc, equalTo("All the ratings methods"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:19,代码来源:AirlinesAppTest.java
示例17: testHeaderInAPIResponse
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testHeaderInAPIResponse(String type) {
ValidatableResponse vr = callEndpoint(type);
// Headers within APIResponse
String responseHeader1 = "paths.'/reviews/{id}'.get.responses.'200'.headers.responseHeader1";
vr.body(responseHeader1, notNullValue());
vr.body(responseHeader1 + ".description", equalTo("Max rate"));
vr.body(responseHeader1 + ".required", equalTo(true));
vr.body(responseHeader1 + ".deprecated", equalTo(true));
vr.body(responseHeader1 + ".allowEmptyValue", equalTo(true));
vr.body(responseHeader1 + ".style", equalTo("simple"));
vr.body(responseHeader1 + ".schema.type", equalTo("integer"));
String responseHeader2 = "paths.'/reviews/{id}'.get.responses.'200'.headers.responseHeader2";
vr.body(responseHeader2, notNullValue());
vr.body(responseHeader2 + ".description", equalTo("Input value"));
vr.body(responseHeader2 + ".required", equalTo(true));
vr.body(responseHeader2 + ".deprecated", equalTo(true));
vr.body(responseHeader2 + ".allowEmptyValue", equalTo(true));
vr.body(responseHeader2 + ".style", equalTo("simple"));
vr.body(responseHeader2 + ".schema.type", equalTo("string"));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:25,代码来源:AirlinesAppTest.java
示例18: testContentInAPIResponse
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testContentInAPIResponse(String type) {
ValidatableResponse vr = callEndpoint(type);
String content1 = "paths.'/availability'.get.responses.'200'.content.'application/json'";
vr.body(content1, notNullValue());
vr.body(content1 + ".schema.type", equalTo("array"));
vr.body(content1 + ".schema.items.$ref", equalTo("#/components/schemas/Flight"));
String content2 = "paths.'/user/{username}'.put.responses.'200'.content";
vr.body(content2, notNullValue());
vr.body(content2 + ".'application/json'", notNullValue());
vr.body(content2 + ".'application/json'.schema.$ref", equalTo("#/components/schemas/User"));
vr.body(content2 + ".'application/json'.encoding.password", notNullValue());
vr.body(content2, notNullValue());
vr.body(content2 + ".'application/xml'", notNullValue());
vr.body(content2 + ".'application/xml'.schema.$ref", equalTo("#/components/schemas/User"));
vr.body(content2 + ".'application/xml'.encoding.password", notNullValue());
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:22,代码来源:AirlinesAppTest.java
示例19: testSchema
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSchema(String type) {
ValidatableResponse vr = callEndpoint(type);
// Schema and DiscriminatorMapping annotation tests
// Basic properties
vr.body("paths.'/pet/findByTags'.get.parameters.find{ it.name == 'tags' }.schema.default", equalTo("Dog"));
vr.body("paths.'/pet/findByTags'.get.parameters.find{ it.name == 'tags' }.schema.enum", hasItems("Cat", "Dog", "Lizard"));
vr.body("paths.'/pet/findByTags'.get.parameters.find{ it.name == 'tags' }.schema.externalDocs.description", equalTo("Pet Types"));
vr.body("paths.'/pet/findByTags'.get.parameters.find{ it.name == 'tags' }.schema.deprecated", equalTo(true));
vr.body("paths.'/store/order/{orderId}'.get.responses.'900'.schema", nullValue());
// Numerical properties
vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.maximum", equalTo(101));
vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.exclusiveMaximum", equalTo(true));
vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.minimum", equalTo(9));
vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.exclusiveMinimum", equalTo(true));
vr.body("paths.'/pet/{petId}'.get.parameters.find{ it.name == 'petId' }.schema.multipleOf", equalTo(10));
// String properties
vr.body("paths.'/pet/{petId}'.delete.parameters.find{ it.name == 'apiKey' }.schema.maxLength", equalTo(256));
vr.body("paths.'/pet/{petId}'.delete.parameters.find{ it.name == 'apiKey' }.schema.minLength", equalTo(32));
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:25,代码来源:PetStoreAppTest.java
示例20: testSecurityRequirement
import io.restassured.response.ValidatableResponse; //导入依赖的package包/类
@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSecurityRequirement(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/pet'.put.security.petsHttp[0][0]", equalTo(null));
vr.body("paths.'/pet'.post.security.petsApiKey[0][0]", equalTo(null));
vr.body("paths.'/pet/{petId}'.delete.security.petsOAuth2[0][0]", equalTo("write:pets"));
vr.body("paths.'/store/inventory'.get.security.storeOpenIdConnect[0]", hasSize(2));
vr.body("paths.'/store/inventory'.get.security.storeOpenIdConnect[0][0]", equalTo("write:store"));
vr.body("paths.'/store/inventory'.get.security.storeOpenIdConnect[0][1]", equalTo("read:store"));
vr.body("paths.'/store/inventory'.get.security.storeHttp[0]", equalTo(null));
vr.body("paths.'/store/order/{orderId}'.get.security.storeOpenIdConnect", hasSize(2));
vr.body("paths.'/store/order/{orderId}'.get.security.storeOpenIdConnect[0][0]", equalTo("write:store"));
vr.body("paths.'/store/order/{orderId}'.get.security.storeOpenIdConnect[0][1]", equalTo("read:store"));
vr.body("paths.'/store/order/{orderId}'.get.security.find { it.storeHttp != null }.storeHttp", empty());
vr.body("paths.'/user'.post.security.find { it.userApiKey != null }.userApiKey", empty());
vr.body("paths.'/user'.post.security.find { it.userBasicHttp != null }.userBasicHttp", empty());
vr.body("paths.'/user'.post.security.find { it.userBearerHttp != null }.userBearerHttp", empty());
}
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:26,代码来源:PetStoreAppTest.java
注:本文中的io.restassured.response.ValidatableResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论