From 74746e8dd56898d27a09ea070f36234380e73bc5 Mon Sep 17 00:00:00 2001 From: Tsuyoshi Yoshizawa Date: Fri, 6 Oct 2023 16:28:17 +0900 Subject: [PATCH] remove warnings by compiler for spec (#163) --- .../provider/AuthorizationRequestSpec.scala | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/test/scala/scalaoauth2/provider/AuthorizationRequestSpec.scala b/src/test/scala/scalaoauth2/provider/AuthorizationRequestSpec.scala index 2fba70f..b59584e 100644 --- a/src/test/scala/scalaoauth2/provider/AuthorizationRequestSpec.scala +++ b/src/test/scala/scalaoauth2/provider/AuthorizationRequestSpec.scala @@ -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 { @@ -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 { @@ -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 { @@ -86,10 +92,13 @@ 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 { @@ -97,10 +106,11 @@ class AuthorizationRequestSpec extends AnyFlatSpec { 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 {