src/test/java/edu/ucla/library/iiif/auth/handlers/AccessCookieHandlerIT.java
@Test
    public void testGetCookieUnknownOrigin(final Vertx aVertx, final VertxTestContext aContext) {
        final String requestUri = StringUtils.format(GET_COOKIE_PATH,
                URLEncoder.encode("https://iiif.unknown.library.ucla.edu", StandardCharsets.UTF_8));
        final HttpRequest<?> getCookie = myWebClient.get(myPort, TestConstants.INADDR_ANY, requestUri);

        getCookie.send().onSuccess(response -> {
            assertEquals(HTTP.INTERNAL_SERVER_ERROR, response.statusCode());
            assertEquals(MediaType.TEXT_HTML.toString(), response.headers().get(HttpHeaders.CONTENT_TYPE));

            aContext.completeNow();
        }).onFailure(aContext::failNow);
    }
/**
     * Tests that a client can't obtain an access cookie for an unknown origin.
     *
     * @param aVertx A Vert.x instance
     * @param aContext A test context
     */
Tests that a client can't obtain an access cookie for an unknown origin.
@param aVertx A Vert.x instance
@param aContext A test context
Tests that a client can ' t obtain an access cookie for an unknown origin . @param aVertx A Vert . x instance @param aContext A test context
@Test
    public void testGetCookieUnknownOrigin(final Vertx aVertx, final VertxTestContext aContext) {
        final String requestUri = StringUtils.format(GET_COOKIE_PATH,
                URLEncoder.encode("https://iiif.unknown.library.ucla.edu", StandardCharsets.UTF_8));
        final HttpRequest<?> getCookie = myWebClient.get(myPort, TestConstants.INADDR_ANY, requestUri);
        getCookie.send().onSuccess(response -> {
            assertEquals(HTTP.INTERNAL_SERVER_ERROR, response.statusCode());
            assertEquals(MediaType.TEXT_HTML.toString(), response.headers().get(HttpHeaders.CONTENT_TYPE));
            aContext.completeNow();
        }).onFailure(aContext::failNow);
    }
@ Test public void testGetCookieUnknownOrigin ( final Vertx aVertx , final VertxTestContext aContext ) { final String requestUri = StringUtils . format ( GET_COOKIE_PATH , URLEncoder . encode ( "https://iiif.unknown.library.ucla.edu" , StandardCharsets . UTF_8 ) ) ; final HttpRequest < ? > getCookie = myWebClient . get ( myPort , TestConstants . INADDR_ANY , requestUri ) ; getCookie . send ( ) . onSuccess ( response -> { assertEquals ( HTTP . INTERNAL_SERVER_ERROR , response . statusCode ( ) ) ; assertEquals ( MediaType . TEXT_HTML . toString ( ) , response . headers ( ) . get ( HttpHeaders . CONTENT_TYPE ) ) ; aContext . completeNow ( ) ; } ) . onFailure ( aContext :: failNow ) ; }
Tests that a client can't obtain an access cookie for an unknown origin.
Tests that a client can ' t obtain an access cookie for an unknown origin .