This PR replaces all occurances of interface{} with any to be consistent and improve readability. * example: Replace `interface{}` with `any` Signed-off-by: Thomas Hipp <thomashipp@gmail.com> * pkg/client: Replace `interface{}` with `any` Signed-off-by: Thomas Hipp <thomashipp@gmail.com> * pkg/crypto: Replace `interface{}` with `any` Signed-off-by: Thomas Hipp <thomashipp@gmail.com> * pkg/http: Replace `interface{}` with `any` Signed-off-by: Thomas Hipp <thomashipp@gmail.com> * pkg/oidc: Replace `interface{}` with `any` Signed-off-by: Thomas Hipp <thomashipp@gmail.com> * pkg/op: Replace `interface{}` with `any` Signed-off-by: Thomas Hipp <thomashipp@gmail.com> --------- Signed-off-by: Thomas Hipp <thomashipp@gmail.com>
40 lines
743 B
Go
40 lines
743 B
Go
package oidc
|
|
|
|
// This file contains common functions and data for regression testing
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io"
|
|
"path"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
const dataDir = "regression_data"
|
|
|
|
// jsonFilename builds a filename for the regression testdata.
|
|
// dataDir/<type_name>.json
|
|
func jsonFilename(obj any) string {
|
|
name := fmt.Sprintf("%T.json", obj)
|
|
return path.Join(
|
|
dataDir,
|
|
strings.TrimPrefix(name, "*"),
|
|
)
|
|
}
|
|
|
|
func encodeJSON(t *testing.T, w io.Writer, obj any) {
|
|
enc := json.NewEncoder(w)
|
|
enc.SetIndent("", "\t")
|
|
require.NoError(t, enc.Encode(obj))
|
|
}
|
|
|
|
var regressionData = []any{
|
|
accessTokenData,
|
|
idTokenData,
|
|
introspectionResponseData,
|
|
userInfoData,
|
|
jwtProfileAssertionData,
|
|
}
|