FunctionalTest : session problem
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
play framework | Status tracked in 1.0 | |||||
1.0 |
Fix Released
|
Undecided
|
Erwan Loisant | |||
1.1 |
Fix Committed
|
Undecided
|
Erwan Loisant |
Bug Description
In a FunctionalTest, sessions aren't restore between 2 requests.
For instance, after a login request, and a homepage get,
the login response will contains a different session of the homepage get response.
This is a use case in the Chat sample application :
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.junit.*;
import play.Logger;
import play.mvc.Http.*;
import play.test.*;
public class BugUseCase extends FunctionalTest {
private void displayCookies(
for (String key : cookies.keySet())
Logger.info("%s = %s",key, cookies.
}
@Test
public void usecase () {
GET("/logout"); // clear session
Map<String, String> args = new HashMap<String, String>();
args.put("nick", "toto");
Response loginResponse = POST("/signin", args, new HashMap<
displayCookie
Response r = GET("/"); // Get main page
displayCookie
assertEquals(
assertIsOk(r); // Failure, Response status expected:<200> but was:<302> (in fact the login has failed)
}
}
log :
14:26:14,145 INFO ~ PLAY_FLASH =
14:26:14,145 INFO ~ PLAY_ERRORS =
14:26:14,145 INFO ~ PLAY_SESSION = d94b6eaa6b58710
14:26:14,154 INFO ~ PLAY_FLASH =
14:26:14,154 INFO ~ PLAY_ERRORS =
14:26:14,154 INFO ~ PLAY_SESSION = e6ff5f33bfc19e3
in the test page :
Failure, expected:
Best regards,
Gaetan Renaudeau
Changed in play: | |
status: | New → Fix Committed |
Yes I know. Cookie support is not yet implemented.
On Wed, Dec 16, 2009 at 2:29 PM, Gaetan Renaudeau <email address hidden> wrote: launchpadlibrar ian.net/ 36868353/ BugUseCase. java /bugs.launchpad .net/bugs/ 497408
>
> ** Attachment added: "use case of the bug in chat sample application."
> http://
>
> --
> FunctionalTest : session problem
> https:/
> You received this bug notification because you are a member of play
> framework developers, which is subscribed to play framework.
>