我有一个测试用例,应该验证在 POST 调用之后,用户被重定向到正确的页面。
"Redirect Page" in {
running(FakeApplication()) {
val Some(result) = route(FakeRequest(POST, "/product/add/something")
.withFormUrlEncodedBody(
"Id" -> "666",
)
.withSession("email" -> "User")
)
status(result) must equalTo(SEE_OTHER)
// contentAsString(result) at this point is just blank
这将验证是否给出了重定向 URL。然后如何让单元测试转到重定向的 URL,以便我可以验证其内容?