Skip to content

Commit

Permalink
Merge pull request #35 from hmrc/TAMC-1058
Browse files Browse the repository at this point in the history
TAMC-1058 changes related to removal of pre IV page
  • Loading branch information
Michael Kitchen authored Jun 17, 2016
2 parents 06829ac + 5e1466e commit b42614a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 109 deletions.
7 changes: 1 addition & 6 deletions app/actions/AuthorisedActions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,9 @@ trait IdaAuthentificationProvider extends Verify with RunMode with TamcBreadcrum
val customAuditConnector: AuditConnector

override def redirectToLogin(implicit request: Request[_]): Future[Result] =
isGdsOrPtaJourney(request) match {
case true =>
Logger.info("User has visited eligibility or verify page, redirecting to login")
{
customAuditConnector.sendEvent(RiskTriageRedirectEvent())
super.redirectToLogin
case _ =>
Logger.info("User has not visited eligibility page or verify page, redirecting to verify page")
Future(Redirect(controllers.routes.MultiYearGdsEligibilityController.verify()))
}

override def handleSessionTimeout(implicit request: Request[_]): Future[Result] =
Expand Down
8 changes: 0 additions & 8 deletions app/controllers/LanguageController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ class LanguageController extends FrontendController {
Redirect(routes.MultiYearGdsEligibilityController.partnersIncomeCheck()).withLang(Lang(ApplicationConfig.LANG_CODE_ENGLISH))
}

def switchToWelshVerify = Action { implicit request =>
Redirect(routes.MultiYearGdsEligibilityController.verify()).withLang(Lang(ApplicationConfig.LANG_CODE_WELSH))
}

def switchToEnglishVerify = Action { implicit request =>
Redirect(routes.MultiYearGdsEligibilityController.verify()).withLang(Lang(ApplicationConfig.LANG_CODE_ENGLISH))
}

def switchToWelshHistory = Action { implicit request =>
Redirect(routes.UpdateRelationshipController.history()).withLang(Lang(ApplicationConfig.LANG_CODE_WELSH))
}
Expand Down
10 changes: 1 addition & 9 deletions app/controllers/MultiYearGdsEligibilityController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,8 @@ trait MultiYearGdsEligibilityController extends FrontendController with Unauthor
BadRequest(views.html.multiyear.gds.partners_income_question(formWithErrors)),
partnersIncomeInput => {
partnersIncomeInput.partnersIncomeQuestion match {
case _ => Redirect(controllers.routes.MultiYearGdsEligibilityController.verify())
case _ => Redirect(controllers.routes.UpdateRelationshipController.history())
}
})
}

def verify = unauthorisedAction {
implicit request =>
setPtaAwareGdsJourney(
request = request,
Ok(views.html.verify()))
}

}
42 changes: 0 additions & 42 deletions app/views/verify.scala.html

This file was deleted.

3 changes: 0 additions & 3 deletions conf/app.routes
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ GET /lower-earner controllers.MultiYearGdsEligi
POST /lower-earner controllers.MultiYearGdsEligibilityController.lowerEarnerCheckAction
GET /partners-income controllers.MultiYearGdsEligibilityController.partnersIncomeCheck
POST /partners-income controllers.MultiYearGdsEligibilityController.partnersIncomeCheckAction
GET /verify controllers.MultiYearGdsEligibilityController.verify

#Welsh Translation
GET /switch-to-welsh-eligibility-check controllers.LanguageController.switchToWelshEligibilityCheck
Expand All @@ -68,8 +67,6 @@ GET /switch-to-welsh-lower-earner controllers.LanguageControlle
GET /switch-to-english-lower-earner controllers.LanguageController.switchToEnglishLowerEarnerCheck
GET /switch-to-welsh-partners-income controllers.LanguageController.switchToWelshPartnersIncomeCheck
GET /switch-to-english-partners-income controllers.LanguageController.switchToEnglishPartnersIncomeCheck
GET /switch-to-welsh-verify controllers.LanguageController.switchToWelshVerify
GET /switch-to-english-verify controllers.LanguageController.switchToEnglishVerify
GET /switch-to-welsh-history controllers.LanguageController.switchToWelshHistory
GET /switch-to-english-history controllers.LanguageController.switchToEnglishHistory
GET /switch-to-welsh-confirm-email controllers.LanguageController.switchToWelshConfirmEmail
Expand Down
15 changes: 0 additions & 15 deletions test/controllers/LanguageControllerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,6 @@ class LanguageControllerTest extends UnitSpec with TestUtility {
}
}

"Hitting language selection endpoint on GDS journey verify page" should {
"redirect to Welsh translated start page if Welsh language is selected" in new WithApplication(FakeApplication()) {
val request = FakeRequest()
val result = Future.successful(controllers.LanguageController.switchToWelshVerify(request))
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
header("Set-Cookie", result) shouldBe Some("PLAY_LANG=cy-GB; Path=/; HTTPOnly")
}
"redirect to English translated start page if English language is selected" in new WithApplication(FakeApplication()) {
val request = FakeRequest()
val result = Future.successful(controllers.LanguageController.switchToEnglishVerify(request))
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
header("Set-Cookie", result) shouldBe Some("PLAY_LANG=en-GB; Path=/; HTTPOnly")
}
}

"Hitting language selection endpoint on history/status page" should {
"redirect to Welsh translated start page if Welsh language is selected" in new WithApplication(FakeApplication()) {
val request = FakeRequest()
Expand Down
33 changes: 7 additions & 26 deletions test/controllers/RoutesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -138,25 +138,6 @@ class RoutesTest extends UnitSpec with TestUtility {
}
}

"Hitting verify page" should {
"have a link to register page (if user has seen eligibility check page)" in new WithApplication(fakeApplication) {
val request = FakeRequest().withCookies(Cookie("TAMC_JOURNEY", "GDS"))
val controllerToTest = makeMultiYearGdsEligibilityController()
val result = controllerToTest.verify()(request)
status(result) shouldBe OK

val document = Jsoup.parse(contentAsString(result))
val continue = document.getElementById("verify")
continue shouldNot be(null)
continue.text() shouldBe "Start now"
continue.attr("href") shouldBe "/marriage-allowance-application/history"

val back = document.getElementsByClass("link-back")
back shouldNot be(null)
back.attr("href") shouldBe marriageAllowanceUrl("/partners-income")
}
}

"Transfer page" should {
"redirect to status page if relationship creation is locked" in new WithApplication(fakeApplication) {
val trrec = UserRecord(cid = Cids.cid1, timestamp = "2015", name = TestConstants.GENERIC_CITIZEN_NAME)
Expand Down Expand Up @@ -192,14 +173,14 @@ class RoutesTest extends UnitSpec with TestUtility {
redirectLocation(result) shouldBe Some("/marriage-allowance-application/history")
}

"redirect to verify page if user tries to hit any authorized page directly and user has not seen eligibility or verify page" in new WithApplication(fakeApplication) {
"redirect to iv page if user tries to hit any authorized page directly and user has not seen eligibility or verify page" in new WithApplication(fakeApplication) {
val testComponent = makeTestComponent(dataId = "not_logged_in", riskTriageRouteBiasPercentageParam = 100)
val controllerToTest = testComponent.controller
val request = FakeRequest()
val result = controllerToTest.transfer()(request)

status(result) shouldBe SEE_OTHER
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
redirectLocation(result) shouldBe Some("bar")
}

"redirect to IV if user tries to hit any authorized page directly and user has seen eligibility page" in new WithApplication(fakeApplication) {
Expand Down Expand Up @@ -556,7 +537,7 @@ class RoutesTest extends UnitSpec with TestUtility {
val controllerToTest = testComponent.controller
val result = controllerToTest.howItWorks()(request)
status(result) shouldBe SEE_OTHER
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
redirectLocation(result) shouldBe Some("bar")
}

"successfully authenticate the user " in new WithApplication(fakeApplication) {
Expand All @@ -583,7 +564,7 @@ class RoutesTest extends UnitSpec with TestUtility {
val controllerToTest = testComponent.controller
val result = controllerToTest.calculator()(request)
status(result) shouldBe SEE_OTHER
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
redirectLocation(result) shouldBe Some("bar")
}

"successfully authenticate the user " in new WithApplication(fakeApplication) {
Expand All @@ -609,7 +590,7 @@ class RoutesTest extends UnitSpec with TestUtility {
val controllerToTest = testComponent.controller
val result = controllerToTest.eligibilityCheck()(request)
status(result) shouldBe SEE_OTHER
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
redirectLocation(result) shouldBe Some("bar")
}

"go to finish in 'nyn' scenario" in new WithApplication(fakeApplication) {
Expand Down Expand Up @@ -672,7 +653,7 @@ class RoutesTest extends UnitSpec with TestUtility {
val controllerToTest = testComponent.controller
val result = controllerToTest.eligibilityCheck()(request)
status(result) shouldBe SEE_OTHER
redirectLocation(result) shouldBe Some("/marriage-allowance-application/verify")
redirectLocation(result) shouldBe Some("bar")
}

"successfully authenticate the user and have eligibility-check page action" in new WithApplication(fakeApplication) {
Expand Down Expand Up @@ -920,7 +901,7 @@ class RoutesTest extends UnitSpec with TestUtility {
val controllerToTest = makeMultiYearGdsEligibilityController()
val result = controllerToTest.partnersIncomeCheckAction()(request)
status(result) shouldBe SEE_OTHER
redirectLocation(result) shouldBe Some(marriageAllowanceUrl("/verify"))
redirectLocation(result) shouldBe Some(marriageAllowanceUrl("/history"))
}
}
}

0 comments on commit b42614a

Please sign in to comment.