feat: support verification_url workaround for DeviceAuthorizationResponse unmarshal (#577)
This commit is contained in:
parent
33485b82ba
commit
e75a061807
2 changed files with 52 additions and 0 deletions
30
pkg/oidc/device_authorization_test.go
Normal file
30
pkg/oidc/device_authorization_test.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package oidc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestDeviceAuthorizationResponse_UnmarshalJSON(t *testing.T) {
|
||||
jsonStr := `{
|
||||
"device_code": "deviceCode",
|
||||
"user_code": "userCode",
|
||||
"verification_url": "http://example.com/verify",
|
||||
"expires_in": 3600,
|
||||
"interval": 5
|
||||
}`
|
||||
|
||||
expected := &DeviceAuthorizationResponse{
|
||||
DeviceCode: "deviceCode",
|
||||
UserCode: "userCode",
|
||||
VerificationURI: "http://example.com/verify",
|
||||
ExpiresIn: 3600,
|
||||
Interval: 5,
|
||||
}
|
||||
|
||||
var resp DeviceAuthorizationResponse
|
||||
err := resp.UnmarshalJSON([]byte(jsonStr))
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, &resp)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue