How can I test routes in play when installed silhouette? How can I authenticate in?
This is test sample
package api
import com.mohiva.play.silhouette.api.LoginInfo
import com.mohiva.play.silhouette.impl.User
import org.specs2.mutable.Specification
import play.api.test._
import play.api.test.Helpers._
import com.mohiva.play.silhouette.test._
class Test extends Specification {
"respond to the index Action" in new WithApplication() {
val Some(result) = route(app, FakeRequest(GET, "/api/v1/countries"))
status(result) must equalTo(OK)
}
}
This is test output
[info] Test
[info]
[error] x respond to the index Action
[error] '401' is not equal to '200' (Test.scala:14)
Aucun commentaire:
Enregistrer un commentaire