Skip to content

Commit

Permalink
Write simple tests, which test the routes for setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliDy committed Mar 16, 2015
1 parent 0ab14ee commit 6621934
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/com/yetu/oauth2provider/views/confirmmail.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<html>
<head>
<title>Confirm Mail</title>
<title>Confirm e-mail</title>
<link rel="stylesheet" media="screen" href="@controllers.routes.Assets.at("stylesheets/setup.css")">
<link rel="stylesheet" media="screen" href="@controllers.routes.Assets.at("stylesheets/confirmmail.css")">
<link rel="shortcut icon" type="image/png" href="">
Expand Down
39 changes: 39 additions & 0 deletions test/com/yetu/oauth2provider/routes/SetupSpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.yetu.oauth2provider.routes

import com.yetu.oauth2provider.base.BaseRoutesSpec
import play.api.mvc.Result
import play.api.test.FakeRequest
import play.api.test.Helpers._

import scala.concurrent.Future

/**
* Created by elisahilprecht on 16/03/15.
*/
class SetupSpec extends BaseRoutesSpec {

def requestReturnOk(urlRequest: String): Future[Result] = {
val Some(result) = route(FakeRequest(GET, urlRequest))
status(result) mustEqual (OK)
return result;
}

"setup controller" must {
"return registration page with title 'Registration'" in {
val result = requestReturnOk(setupRegistrationUrl)
contentAsString(result) must include("<title>Registration</title>")
}
"return confirm mail page with title 'Confirm e-mail'" in {
val result = requestReturnOk(setupConfirmMailUrl)
contentAsString(result) must include("<title>Confirm e-mail</title>")
}
"return confirmed mail page with title confirm 'Successfully confirmed mail'" in {
val result = requestReturnOk(setupConfirmedMailUrl)
contentAsString(result) must include("<title>Successfully confirmed mail</title>")
}
"return download page with title confirm 'Download'" in {
val result = requestReturnOk(setupDownloadUrl)
contentAsString(result) must include("<title>Download</title>")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import com.yetu.oauth2provider.registry.TestRegistry
import com.yetu.oauth2provider.utils.Config
import com.yetu.oauth2provider.utils.Config._
import play.api.libs.json.Json
import play.api.test.FakeRequest
import play.api.test.Helpers._
import securesocial.core.{ PasswordInfo, AuthenticationMethod }

import scalaoauth2.provider.{ AccessToken, AuthInfo }
Expand All @@ -34,6 +36,10 @@ trait DefaultTestVariables {

val updateUrl = "/profile"
val healthUrl = "/health"
val setupRegistrationUrl = "/setup/registration"
val setupConfirmMailUrl = "/setup/confirmmail"
val setupConfirmedMailUrl = "/setup/confirmedmail"
val setupDownloadUrl = "/setup/download"

val validateUrl = "/oauth2/validate"
val infoUrl = "/oauth2/info"
Expand Down

0 comments on commit 6621934

Please sign in to comment.