Hi all,
I just begin with functional tests and ... I have some questions.
My app is based on the sample app "booking". I used the CRUD module to manage database, and the secure module to restrict access to the CRUD pages (admin area).
I want to check that my admin area need an authenticated user (see attachment).
L17: My test starts with trying to connect to the admin area.
L18: HTTP status must be 302 because user is not authenticated, so he is redirected to a login page.
L19: The test reads the "Location" HTTP header (is there any constant for that ? in Play! or Java ?)
L20+L21: If I just call GET() for the "Location" so I don't have a valid response (404 => Play! page with routes)
L22 to L28: I have to create a java.net.URL to only get the path (not the scheme, the host, ..) so GET() give me the valid response for the redirect
Perhaps my steps are bad. Perhaps I have to make it in a different way.
But if it's correct, I think it's a bit complicated.
Is there a method with Play! like : GETandRedirect("/path/url") ?
Or GETfromURL("
http://localhost/complete/url") ?
Thanks for help.
PS: I also see there is a class : FunctionalTest.URL
But I don't know what I can do with it.