Skip to content

Commit 44d46f3

Browse files
committed
add test for invalid content of scope
1 parent 2894ee6 commit 44d46f3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

oauth2/shared/src/test/scala/com/ocadotechnology/sttp/oauth2/json/ClientCredentialsAccessTokenResponseDeserializationSpec.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,22 @@ trait ClientCredentialsAccessTokenResponseDeserializationSpec extends AnyFlatSpe
8282
)
8383
}
8484

85+
"Token with malformed scope" should "not be deserialized" in {
86+
val json =
87+
// language=JSON
88+
"""
89+
{
90+
"access_token": "TAeJwlzT",
91+
"domain": "mock",
92+
"expires_in": 2399,
93+
"scope": "déjà vu",
94+
"token_type": "Bearer"
95+
}
96+
"""
97+
98+
JsonDecoder[ClientCredentialsToken.AccessTokenResponse].decodeString(json).left.value shouldBe a[JsonDecoder.Error]
99+
}
100+
85101
"Token with wildcard scope" should "not be deserialized" in {
86102
val json =
87103
// language=JSON

0 commit comments

Comments
 (0)