Files
threshold/api/authmethods/authenticate_test.go
T
dd0f34bc35 Add new OIDC auth method. (#1090)
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2021-04-08 20:54:32 -04:00

29 lines
592 B
Go

package authmethods
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
func TestAuthenticateResultMarshaling(t *testing.T) {
rawJson := []byte(`{"attributes":{"key":"value"},"command":"foo"}`)
a := new(AuthenticateResult)
require.NoError(t, json.Unmarshal(rawJson, a))
exp := &AuthenticateResult{
Command: "foo",
Attributes: map[string]interface{}{
"key": "value",
},
attributesRaw: json.RawMessage(`{"key":"value"}`),
}
require.Equal(t, exp, a)
mBytes, err := json.Marshal(exp)
require.NoError(t, err)
require.Equal(t, rawJson, mBytes)
}