Files
threshold/api/authmethods/authenticate_test.go
T
Johan Brandhorst-Satzkorn f57454b6b9 Rewrite interface{} to any (#2535)
* chore: Rewrite interface{} to any

* Add ignore revs
2022-10-25 19:29:38 -04:00

29 lines
584 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]any{
"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)
}