Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dataswifty committed Jun 4, 2024
1 parent 9fc9bdc commit 90a8593
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions hat/test/org/hatdex/hat/api/controllers/AuthenticationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class AuthenticationSpec extends AuthenticationContext {
.withJsonBody(Json.toJson(passwordForgottenIncorrect))

val controller = application.injector.instanceOf[Authentication]
val result: Future[Result] = Helpers.call(controller.handleForgotPassword, request)
val result: Future[Result] = Helpers.call(controller.handleForgotPassword(Some(true)), request)

status(result) must equal(OK)
}
Expand All @@ -225,7 +225,7 @@ class AuthenticationSpec extends AuthenticationContext {
.withJsonBody(Json.toJson(passwordForgottenOwner))

val controller = application.injector.instanceOf[Authentication]
val result: Future[Result] = Helpers.call(controller.handleForgotPassword, request)
val result: Future[Result] = Helpers.call(controller.handleForgotPassword(Some(true)), request)

status(result) must equal(OK)
}
Expand All @@ -236,7 +236,7 @@ class AuthenticationSpec extends AuthenticationContext {
.withJsonBody(Json.toJson(passwordResetStrong))

val controller = application.injector.instanceOf[Authentication]
val result: Future[Result] = Helpers.call(controller.handleResetPassword("nosuchtoken"), request)
val result: Future[Result] = Helpers.call(controller.handleResetPassword("nosuchtoken", (Some(true))), request)

status(result) must equal(UNAUTHORIZED)
(contentAsJson(result) \ "cause").as[String] must equal("Token does not exist")
Expand All @@ -253,7 +253,7 @@ class AuthenticationSpec extends AuthenticationContext {

val result: Future[Result] = for {
_ <- tokenService.create(MailTokenUser(tokenId, "[email protected]", DateTime.now().minusHours(1), isSignUp = false))
result <- Helpers.call(controller.handleResetPassword(tokenId), request)
result <- Helpers.call(controller.handleResetPassword(tokenId, (Some(true))), request)
} yield result

status(result) must equal(UNAUTHORIZED)
Expand All @@ -271,7 +271,7 @@ class AuthenticationSpec extends AuthenticationContext {

val result: Future[Result] = for {
_ <- tokenService.create(MailTokenUser(tokenId, "[email protected]", DateTime.now().plusHours(1), isSignUp = false))
result <- Helpers.call(controller.handleResetPassword(tokenId), request)
result <- Helpers.call(controller.handleResetPassword(tokenId, (Some(true))), request)
} yield result

status(result) must equal(UNAUTHORIZED)
Expand All @@ -289,7 +289,7 @@ class AuthenticationSpec extends AuthenticationContext {
val tokenId = UUID.randomUUID().toString
val result: Future[Result] = for {
_ <- tokenService.create(MailTokenUser(tokenId, "[email protected]", DateTime.now().plusHours(1), isSignUp = false))
result <- Helpers.call(controller.handleResetPassword(tokenId), request)
result <- Helpers.call(controller.handleResetPassword(tokenId, (Some(true))), request)
} yield result

status(result) must equal(OK)
Expand All @@ -310,7 +310,7 @@ class AuthenticationSpec extends AuthenticationContext {
_ <- userService.saveUser(
owner.copy(roles = Seq(DataDebitOwner("")))
) // forcing owner user to a different role for the test
result <- Helpers.call(controller.handleResetPassword(tokenId), request)
result <- Helpers.call(controller.handleResetPassword(tokenId, (Some(true))), request)
} yield result

status(result) must equal(UNAUTHORIZED)
Expand All @@ -323,7 +323,7 @@ class AuthenticationSpec extends AuthenticationContext {
.withJsonBody(Json.toJson(apiVerificationRequestMatching))

val controller = application.injector.instanceOf[Authentication]
val result: Future[Result] = Helpers.call(controller.handleVerificationRequest(None), request)
val result: Future[Result] = Helpers.call(controller.handleVerificationRequest(None, (Some(true))), request)

status(result) must equal(OK)
}
Expand All @@ -334,7 +334,7 @@ class AuthenticationSpec extends AuthenticationContext {
.withJsonBody(Json.toJson(apiVerificationRequestNotMatching))

val controller = application.injector.instanceOf[Authentication]
val result: Future[Result] = Helpers.call(controller.handleVerificationRequest(None), request)
val result: Future[Result] = Helpers.call(controller.handleVerificationRequest(None, (Some(true))), request)

status(result) must equal(OK)
}
Expand Down

0 comments on commit 90a8593

Please sign in to comment.