aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/core/AuthTest.scala
diff options
context:
space:
mode:
authorvlad <vlad@drivergrp.com>2016-11-29 14:08:56 -0800
committervlad <vlad@drivergrp.com>2016-11-29 14:08:56 -0800
commit16b308b33a0c300e756ff2725affd8259a69ad85 (patch)
treeba94d9536e71fce561e8aa269fadf22290c32bae /src/test/scala/xyz/driver/core/AuthTest.scala
parenteea7df07092cebf7f0c4999d7cf926d56e3c6f19 (diff)
downloaddriver-core-16b308b33a0c300e756ff2725affd8259a69ad85.tar.gz
driver-core-16b308b33a0c300e756ff2725affd8259a69ad85.tar.bz2
driver-core-16b308b33a0c300e756ff2725affd8259a69ad85.zip
Changed ids underlying type to String and made Ids and Names — value-classes
Diffstat (limited to 'src/test/scala/xyz/driver/core/AuthTest.scala')
-rw-r--r--src/test/scala/xyz/driver/core/AuthTest.scala17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/test/scala/xyz/driver/core/AuthTest.scala b/src/test/scala/xyz/driver/core/AuthTest.scala
index e5e991b..f4d4d2a 100644
--- a/src/test/scala/xyz/driver/core/AuthTest.scala
+++ b/src/test/scala/xyz/driver/core/AuthTest.scala
@@ -19,7 +19,7 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
override def authStatus(context: ServiceRequestContext): OptionT[Future, User] = OptionT.optionT[Future] {
if (context.contextHeaders.keySet.contains(AuthService.AuthenticationTokenHeader)) {
Future.successful(Some(new User {
- override def id: Id[User] = Id[User](1L)
+ override def id: Id[User] = Id[User]("1")
override def roles: Set[Role] = Set(PathologistRole)
}: User))
} else {
@@ -33,9 +33,8 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
"'authorize' directive" should "throw error is auth token is not in the request" in {
Get("/naive/attempt") ~>
- authorize(CanSignOutReport) {
- case user =>
- complete("Never going to be here")
+ authorize(CanSignOutReport) { user =>
+ complete("Never going to be here")
} ~>
check {
// handled shouldBe false
@@ -50,9 +49,8 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
Post("/administration/attempt").addHeader(
RawHeader(AuthService.AuthenticationTokenHeader, referenceAuthToken.value)
) ~>
- authorize(CanAssignRoles) {
- case user =>
- complete("Never going to get here")
+ authorize(CanAssignRoles) { user =>
+ complete("Never going to get here")
} ~>
check {
handled shouldBe false
@@ -70,9 +68,8 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
Get("/valid/attempt/?a=2&b=5").addHeader(
RawHeader(AuthService.AuthenticationTokenHeader, referenceAuthToken.value)
) ~>
- authorize(CanSignOutReport) {
- case user =>
- complete("Alright, user \"" + user.id + "\" is authorized")
+ authorize(CanSignOutReport) { user =>
+ complete("Alright, user \"" + user.id + "\" is authorized")
} ~>
check {
handled shouldBe true