Skip to content

Commit

Permalink
ID-808 Implement PUT /api/termsOfService/v1/user/self/accept
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-in-a-Jar committed Nov 9, 2023
1 parent e08c499 commit f226999
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,9 @@ trait TermsOfServiceRoutes extends SamUserDirectives {
complete {
tosService.getTermsOfServiceDetailsForUser(samUser.id, samRequestContext)
}
}
} ~
pathPrefix("accept") { // api/termsOfService/v1/user/accept
pathEndOrSingleSlash {
put {
complete(StatusCodes.NotImplemented)
}
} ~
put {
complete(tosService.acceptTosStatus(samUser.id, samRequestContext).map(_ => StatusCodes.NoContent))
}
} ~
pathPrefix("reject") { // api/termsOfService/v1/user/reject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,14 @@ class TermsOfServiceRouteSpec extends AnyFunSpec with Matchers with ScalatestRou
}
}

it("should return 200 when tos accepted") {
val samRoutes = TestSamRoutes(Map.empty)
eventually {
Put("/api/termsOfService/v1/user/self") ~> samRoutes.route ~> check {
status shouldEqual StatusCodes.NoContent
responseAs[String] shouldBe ""
}
}
}

}

0 comments on commit f226999

Please sign in to comment.