aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz
diff options
context:
space:
mode:
authorvlad <vlad@drivergrp.com>2016-11-01 15:19:36 -0700
committervlad <vlad@drivergrp.com>2016-11-01 15:19:36 -0700
commit16bdae27befd9cf3b723ad919ba2140b38d18c48 (patch)
tree75ece33cd4e0ac7993b329b13ab8dded05b95bb2 /src/test/scala/xyz
parent88978d91edca16f9c6a4177b5ed997bc12486b29 (diff)
downloaddriver-core-16bdae27befd9cf3b723ad919ba2140b38d18c48.tar.gz
driver-core-16bdae27befd9cf3b723ad919ba2140b38d18c48.tar.bz2
driver-core-16bdae27befd9cf3b723ad919ba2140b38d18c48.zip
DIR-135 Consistent request context extractionv0.9.8
Diffstat (limited to 'src/test/scala/xyz')
-rw-r--r--src/test/scala/xyz/driver/core/AuthTest.scala22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/test/scala/xyz/driver/core/AuthTest.scala b/src/test/scala/xyz/driver/core/AuthTest.scala
index 97279de..ca7e019 100644
--- a/src/test/scala/xyz/driver/core/AuthTest.scala
+++ b/src/test/scala/xyz/driver/core/AuthTest.scala
@@ -16,10 +16,10 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
val authStatusService: AuthService[User] = new AuthService[User] {
override def authStatus(authToken: AuthToken): OptionT[Future, User] = OptionT.optionT[Future] {
- Future.successful(Some(new User() {
+ Future.successful(Some(new User {
override def id: Id[User] = Id[User](1L)
override def roles: Set[Role] = Set(PathologistRole)
- }))
+ }: User))
}
}
@@ -29,7 +29,7 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
Get("/naive/attempt") ~>
authorize(CanSignOutReport) {
- case (authToken, user) =>
+ case user =>
complete("Never going to be here")
} ~>
check {
@@ -40,13 +40,13 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
it should "throw error is authorized user is not having the requested permission" in {
- val referenceAuthToken = AuthToken(Base64("I am a pathologist's token"), "BC131CD")
+ val referenceAuthToken = AuthToken("I am a pathologist's token")
Post("/administration/attempt").addHeader(
- RawHeader(AuthService.AuthenticationTokenHeader, referenceAuthToken.value.value)
+ RawHeader(AuthService.AuthenticationTokenHeader, referenceAuthToken.value)
) ~>
authorize(CanAssignRoles) {
- case (authToken, user) =>
+ case user =>
complete("Never going to get here")
} ~>
check {
@@ -60,18 +60,18 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
it should "pass and retrieve the token to client code, if token is in request and user has permission" in {
- val referenceAuthToken = AuthToken(Base64("I am token"), "AAADDDFFF")
+ val referenceAuthToken = AuthToken("I am token")
Get("/valid/attempt/?a=2&b=5").addHeader(
- RawHeader(AuthService.AuthenticationTokenHeader, referenceAuthToken.value.value)
+ RawHeader(AuthService.AuthenticationTokenHeader, referenceAuthToken.value)
) ~>
authorize(CanSignOutReport) {
- case (authToken, user) =>
- complete("Alright, \"" + authToken.value.value + "\" is handled")
+ case user =>
+ complete("Alright, user \"" + user.id + "\" is authorized")
} ~>
check {
handled shouldBe true
- responseAs[String] shouldBe "Alright, \"I am token\" is handled"
+ responseAs[String] shouldBe "Alright, user \"1\" is authorized"
}
}
}