@Test( groups = {MUST}, description = "LDP servers MUST indicate their support for HTTP Methods " + "by responding to a HTTP OPTIONS request on the LDPR’s URL " + "with the HTTP Method tokens in the HTTP response header Allow. ") @SpecTest( specRefUri = LdpTestSuite.SPEC_URI + "#ldpr-options-allow", testMethod = METHOD.AUTOMATED, approval = STATUS.WG_APPROVED) public void testOptionsAllowHeader() { buildBaseRequestSpecification().expect().statusCode(isSuccessful()).header(ALLOW, notNullValue()) .when().options(getResourceUri()); }
@Override public void perform() { given(). then(). statusCode(Status.OK.getStatusCode()). header("Allow", allOf( not(containsString("POST")), not(containsString("PUT")), not(containsString("DELETE")), not(containsString("PATCH")))). when(). options(testURL.toExternalForm()); } }).inspect(new SetupAuth(null));
@Override public void perform() { given(). then(). statusCode(Status.OK.getStatusCode()). header("Allow", allOf( containsString("GET"), containsString("OPTIONS"), containsString("POST"), containsString("PUT"), containsString("DELETE"), containsString("PATCH"))). when(). options(testURL.toExternalForm()); } }).inspect(new SetupAuth(new User("testuser")));
@Test( groups = {MUST}, description = "LDP servers MUST support the HTTP OPTIONS method. ") @SpecTest( specRefUri = LdpTestSuite.SPEC_URI + "#ldpr-options-must", testMethod = METHOD.AUTOMATED, approval = STATUS.WG_APPROVED) public void testOptions() { buildBaseRequestSpecification().expect().statusCode(isSuccessful()).when().options(getResourceUri()); }
@Test( groups = {MUST}, description = "LDP servers that support PATCH MUST include an " + "Accept-Patch HTTP response header [RFC5789] on HTTP " + "OPTIONS requests, listing patch document media type(s) " + "supported by the server. ") @SpecTest( specRefUri = LdpTestSuite.SPEC_URI + "#ldpr-patch-acceptpatch", testMethod = METHOD.AUTOMATED, approval = STATUS.WG_APPROVED) public void testAcceptPatchHeader() { if (supports(HttpMethod.PATCH)) { buildBaseRequestSpecification() .expect().statusCode(isSuccessful()).header(ACCEPT_PATCH, notNullValue()) .when().options(getResourceUri()); } }
@Override public void perform() { given(). then(). statusCode(Status.OK.getStatusCode()). when(). options(testURL.toExternalForm()); } }).inspect(new SetupAuth(null));
@Override public void perform() { given(). then(). statusCode(Status.OK.getStatusCode()). when(). options(testURL.toExternalForm()); } }).inspect(new SetupAuth(new User("testuser")));
.statusCode(HttpStatus.SC_OK) .when() .options(containerAsResource); assertFalse( containsLinkHeader(
@Test public void shouldProvideOptions() throws Exception { given(). then(). statusCode(Response.Status.OK.getStatusCode()). headers("Allow", containsString("GET")). headers("Allow", not(containsString("POST"))). when(). options(baseURL + "api/test"); } }
@Test( groups = {MUST}, description = "LDP servers that support POST MUST include an Accept-Post " + "response header on HTTP OPTIONS responses, listing post document " + "media type(s) supported by the server.") @SpecTest( specRefUri = LdpTestSuite.SPEC_URI + "#ldpc-post-acceptposthdr", testMethod = METHOD.AUTOMATED, approval = STATUS.WG_APPROVED) public void testAcceptPostResponseHeader() { skipIfMethodNotAllowed(HttpMethod.POST); Response optionsResponse = buildBaseRequestSpecification().expect() .statusCode(isSuccessful()).when() .options(getResourceUri()); assertNotNull( optionsResponse.getHeader(ACCEPT_POST), "The HTTP OPTIONS response on container <" + getResourceUri() + "> did not include an Accept-Post response header, but it lists POST in its Allow response header." ); }
.statusCode(isSuccessful()) .when() .options(location); Assert.assertTrue(containsLinkHeader( location,