Search in sources :

Example 1 with Response

use of play.mvc.Http.Response in project play-cookbook by spinscale.

the class UserRightTest method login.

private void login(String user, String pass) {
    String data = "username=" + user + "&password=" + pass;
    Response response = POST("/login", APPLICATION_X_WWW_FORM_URLENCODED, data);
    assertIsOk(response);
}
Also used : Response(play.mvc.Http.Response)

Example 2 with Response

use of play.mvc.Http.Response in project play-cookbook by spinscale.

the class UserRightTest method testSecretsAreDeniedForUnknownUser.

@Test
public void testSecretsAreDeniedForUnknownUser() {
    Response response = GET("/secret");
    assertStatus(404, response);
}
Also used : Response(play.mvc.Http.Response) FunctionalTest(play.test.FunctionalTest) Test(org.junit.Test)

Example 3 with Response

use of play.mvc.Http.Response in project play-cookbook by spinscale.

the class CachingTest method testThatCachingPagePartsWork.

@Test
public void testThatCachingPagePartsWork() {
    Response response = GET("/");
    String cachedTime = getCachedTime(response);
    assertEquals(getUncachedTime(response), cachedTime);
    response = GET("/");
    String newCachedTime = getCachedTime(response);
    assertNotSame(getUncachedTime(response), newCachedTime);
    assertEquals(cachedTime, newCachedTime);
}
Also used : Response(play.mvc.Http.Response) FunctionalTest(play.test.FunctionalTest) Test(org.junit.Test)

Example 4 with Response

use of play.mvc.Http.Response in project play-cookbook by spinscale.

the class CachingTest method testThatCachingHeadersAreSet.

@Test
public void testThatCachingHeadersAreSet() {
    Response response = GET("/proxyCache");
    assertIsOk(response);
    assertHeaderEquals("Cache-Control", "max-age=3600", response);
}
Also used : Response(play.mvc.Http.Response) FunctionalTest(play.test.FunctionalTest) Test(org.junit.Test)

Example 5 with Response

use of play.mvc.Http.Response in project play-cookbook by spinscale.

the class FeedTest method testThatAtomWorks.

@Test
public void testThatAtomWorks() throws Exception {
    Response response = GET("/feed/posts.atom");
    assertIsOk(response);
    assertContentType("application/atom+xml", response);
    assertCharset("utf-8", response);
    SyndFeed feed = getFeed(response);
    assertEquals("atom_0.3", feed.getFeedType());
}
Also used : Response(play.mvc.Http.Response) SyndFeed(com.sun.syndication.feed.synd.SyndFeed) FunctionalTest(play.test.FunctionalTest) Test(org.junit.Test)

Aggregations

Response (play.mvc.Http.Response)13 Test (org.junit.Test)12 FunctionalTest (play.test.FunctionalTest)12 SyndFeed (com.sun.syndication.feed.synd.SyndFeed)3 Gson (com.google.gson.Gson)1 User (models.User)1 DateTime (org.joda.time.DateTime)1 Header (play.mvc.Http.Header)1 Request (play.mvc.Http.Request)1