package device_test import ( "encoding/json" "os" "testing" "github.com/stretchr/testify/assert" "edge-infra.dev/pkg/edge/iam/device" ) func TestGetDeviceLoginPolicy(t *testing.T) { policyJSON := `{"password":{"min_len":4,"max_len":6,"num_only":true}}` os.Setenv("IAM_DEVICE_POLICY", policyJSON) var devicePolicy device.LoginPolicy err := json.Unmarshal([]byte(policyJSON), &devicePolicy) if err != nil { t.Fail() } assert.Equal(t, 4, devicePolicy.Password.MinLength) assert.Equal(t, 6, devicePolicy.Password.MaxLength) assert.Equal(t, true, devicePolicy.Password.NumericOnly) }