Skip to content

Commit

Permalink
Added assertions to DeserializeClientRegistrationRequestTest
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-abblix committed Dec 2, 2024
1 parent e9f1621 commit 0a16b06
Showing 1 changed file with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,44 @@ namespace Abblix.Oidc.Server.UnitTests.Model;

public class ClientRegistrationRequestTest
{
[Theory]
[InlineData(
"{\"client_name\":\"dynamic_client_1 RqxLk9BdhK8qC3z\",\"grant_types\":[\"implicit\"],\"jwks\":{\"keys\":[{\"kty\":\"RSA\",\"e\":\"AQAB\",\"use\":\"sig\",\"alg\":\"RS256\",\"n\":\"gUOdYo2PpUUnZzozIPJ-7mK2Z5jYBxjj_5iB2TDnElt8yUc-mcCeOQrsaswPgKx2KMSJ50kwrFHHEuNyiDhgNMgtmJ98RuhggXaPF1fmmHss_Wc1OSqyGYLWbEzYGsRck5yTVP4xsPYAeP5xkkLze_FXJvwITNu2aGxXEYwokkrcWgL3AsXtYKClIwmacHhVNEMn-ALe3sMTifx4F8TqmNAlD4FPga094txHJNo2Ho6z4kn5L4uq_WXklDjaIDOqQZtdn0emXig3RHQcOtepFcXt7pcK9E2M3kxKFOMPpY8c4kaDfQ41jv23vbm9oDTh5s3TB0ZwcKJXj4-06gwTWw\"}]},\"token_endpoint_auth_method\":\"client_secret_basic\",\"response_types\":[\"id_token token\"],\"redirect_uris\":[\"https://www.certification.openid.net/test/a/Abblix/callback\"],\"contacts\":[\"[email protected]\"]}")]
public void DeserializeClientRegistrationRequestTest(string json)
[Fact]
public void DeserializeClientRegistrationRequestTest()
{
JsonSerializer.Deserialize<ClientRegistrationRequest>(json);
const string json =
"""
{
"client_name": "dynamic_client_1 RqxLk9BdhK8qC3z",
"grant_types": [
"implicit"
],
"jwks": {
"keys": [
{
"kty": "RSA",
"e": "AQAB",
"use": "sig",
"alg": "RS256",
"n": "gUOdYo2PpUUnZzozIPJ-7mK2Z5jYBxjj_5iB2TDnElt8yUc-mcCeOQrsaswPgKx2KMSJ50kwrFHHEuNyiDhgNMgtmJ98RuhggXaPF1fmmHss_Wc1OSqyGYLWbEzYGsRck5yTVP4xsPYAeP5xkkLze_FXJvwITNu2aGxXEYwokkrcWgL3AsXtYKClIwmacHhVNEMn-ALe3sMTifx4F8TqmNAlD4FPga094txHJNo2Ho6z4kn5L4uq_WXklDjaIDOqQZtdn0emXig3RHQcOtepFcXt7pcK9E2M3kxKFOMPpY8c4kaDfQ41jv23vbm9oDTh5s3TB0ZwcKJXj4-06gwTWw"
}
]
},
"token_endpoint_auth_method": "client_secret_basic",
"response_types": [
"id_token token"
],
"redirect_uris": [
"https://www.certification.openid.net/test/a/Abblix/callback"
],
"contacts": [
"[email protected]"
]
}
""";
var req = JsonSerializer.Deserialize<ClientRegistrationRequest>(json);
Assert.NotNull(req);
Assert.Equal("dynamic_client_1 RqxLk9BdhK8qC3z", req.ClientName);
Assert.Equal(["implicit"], req.GrantTypes);
Assert.Equal([["id_token", "token"]], req.ResponseTypes);
Assert.Equal(["[email protected]"], req.Contacts);
}
}

0 comments on commit 0a16b06

Please sign in to comment.