{
// Signup with a username/password
Map<String, String> data = new HashMap<String, String>();
data.put("email", email);
data.put("password", password);
Result result = callAction(
controllers.routes.ref.Application.doSignup(),
fakeRequest().withFormUrlEncodedBody(data));
assertThat(status(result)).isEqualTo(SEE_OTHER);
}
{
// Validate the token
String token = upAuthProvider().getVerificationToken(email);
assertThat(token).isNotNull();
Logger.info("Verifying token: " + token);
Result result = callAction(controllers.routes.ref.Application
.verify(token));
assertThat(status(result)).isEqualTo(SEE_OTHER);
assertThat(upAuthProvider().getVerificationToken(email)).isNull();
// We should actually be logged in here, but let's ignore that
// as we want to test login too.
assertThat(redirectLocation(result)).isEqualTo("/");
}
{
// Log the user in
Map<String, String> data = new HashMap<String, String>();
data.put("email", email);
data.put("password", password);
Result result = callAction(
controllers.routes.ref.Application.doLogin(), fakeRequest()
.withFormUrlEncodedBody(data));
assertThat(status(result)).isEqualTo(SEE_OTHER);
assertThat(redirectLocation(result)).isEqualTo("/");
// Create a Java session from the Scala session