Skip to content

Commit 74746e8

Browse files
authored
remove warnings by compiler for spec (#163)
1 parent f7d1954 commit 74746e8

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

src/test/scala/scalaoauth2/provider/AuthorizationRequestSpec.scala

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
1414
),
1515
Map()
1616
)
17-
val Some(c) = request.parseClientCredential
18-
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
19-
c.clientId should be("client_id_value")
20-
c.clientSecret should be(Some("client_secret_value"))
17+
18+
request.parseClientCredential
19+
.fold[Option[ClientCredential]](None)(
20+
_.fold(_ => None, c => Some(c))
21+
) should contain(
22+
ClientCredential("client_id_value", Some("client_secret_value"))
23+
)
2124
}
2225

2326
it should "fetch Basic64 by case insensitive" in {
@@ -29,10 +32,13 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
2932
),
3033
Map()
3134
)
32-
val Some(c) = request.parseClientCredential
33-
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
34-
c.clientId should be("client_id_value")
35-
c.clientSecret should be(Some("client_secret_value"))
35+
36+
request.parseClientCredential
37+
.fold[Option[ClientCredential]](None)(
38+
_.fold(_ => None, c => Some(c))
39+
) should contain(
40+
ClientCredential("client_id_value", Some("client_secret_value"))
41+
)
3642
}
3743

3844
it should "fetch authorization header without colon" in {
@@ -50,10 +56,10 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
5056
Map("Authorization" -> Seq("Basic Y2xpZW50X2lkX3ZhbHVlOg==")),
5157
Map()
5258
)
53-
val Some(c) = request.parseClientCredential
54-
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
55-
c.clientId should be("client_id_value")
56-
c.clientSecret should be(None)
59+
request.parseClientCredential
60+
.fold[Option[ClientCredential]](None)(
61+
_.fold(_ => None, c => Some(c))
62+
) should contain(ClientCredential("client_id_value", None))
5763
}
5864

5965
it should "not fetch not Authorization key in header" in {
@@ -86,21 +92,25 @@ class AuthorizationRequestSpec extends AnyFlatSpec {
8692
"client_secret" -> Seq("client_secret_value")
8793
)
8894
)
89-
val Some(c) = request.parseClientCredential
90-
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
91-
c.clientId should be("client_id_value")
92-
c.clientSecret should be(Some("client_secret_value"))
95+
96+
request.parseClientCredential
97+
.fold[Option[ClientCredential]](None)(
98+
_.fold(_ => None, c => Some(c))
99+
) should contain(
100+
ClientCredential("client_id_value", Some("client_secret_value"))
101+
)
93102
}
94103

95104
it should "omit client_secret" in {
96105
val request = new AuthorizationRequest(
97106
Map(),
98107
Map("client_id" -> Seq("client_id_value"))
99108
)
100-
val Some(c) = request.parseClientCredential
101-
.fold[Option[ClientCredential]](None)(_.fold(_ => None, c => Some(c)))
102-
c.clientId should be("client_id_value")
103-
c.clientSecret should be(None)
109+
110+
request.parseClientCredential
111+
.fold[Option[ClientCredential]](None)(
112+
_.fold(_ => None, c => Some(c))
113+
) should contain(ClientCredential("client_id_value", None))
104114
}
105115

106116
it should "not fetch missing parameter" in {

0 commit comments

Comments
 (0)