Skip to content

Commit

Permalink
remove warnings by compiler for spec (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuyoshizawa committed Oct 6, 2023
1 parent f7d1954 commit 74746e8
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions src/test/scala/scalaoauth2/provider/AuthorizationRequestSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
),
Map()
)
val Some(c) = request.parseClientCredential
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
c.clientId should be("client_id_value")
c.clientSecret should be(Some("client_secret_value"))

request.parseClientCredential
.fold[Option[ClientCredential]](None)(
_.fold(_ => None, c => Some(c))
) should contain(
ClientCredential("client_id_value", Some("client_secret_value"))
)
}

it should "fetch Basic64 by case insensitive" in {
Expand All @@ -29,10 +32,13 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
),
Map()
)
val Some(c) = request.parseClientCredential
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
c.clientId should be("client_id_value")
c.clientSecret should be(Some("client_secret_value"))

request.parseClientCredential
.fold[Option[ClientCredential]](None)(
_.fold(_ => None, c => Some(c))
) should contain(
ClientCredential("client_id_value", Some("client_secret_value"))
)
}

it should "fetch authorization header without colon" in {
Expand All @@ -50,10 +56,10 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
Map("Authorization" -> Seq("Basic Y2xpZW50X2lkX3ZhbHVlOg==")),
Map()
)
val Some(c) = request.parseClientCredential
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
c.clientId should be("client_id_value")
c.clientSecret should be(None)
request.parseClientCredential
.fold[Option[ClientCredential]](None)(
_.fold(_ => None, c => Some(c))
) should contain(ClientCredential("client_id_value", None))
}

it should "not fetch not Authorization key in header" in {
Expand Down Expand Up @@ -86,21 +92,25 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
"client_secret" -> Seq("client_secret_value")
)
)
val Some(c) = request.parseClientCredential
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
c.clientId should be("client_id_value")
c.clientSecret should be(Some("client_secret_value"))

request.parseClientCredential
.fold[Option[ClientCredential]](None)(
_.fold(_ => None, c => Some(c))
) should contain(
ClientCredential("client_id_value", Some("client_secret_value"))
)
}

it should "omit client_secret" in {
val request = new AuthorizationRequest(
Map(),
Map("client_id" -> Seq("client_id_value"))
)
val Some(c) = request.parseClientCredential
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
c.clientId should be("client_id_value")
c.clientSecret should be(None)

request.parseClientCredential
.fold[Option[ClientCredential]](None)(
_.fold(_ => None, c => Some(c))
) should contain(ClientCredential("client_id_value", None))
}

it should "not fetch missing parameter" in {
Expand Down

0 comments on commit 74746e8

Please sign in to comment.