dex/db/key_test.go
Eric Chiang 49389c9b90 cmd, db: verify at least one secret is passed to --key-secrets
Passing an empty list to the overlord or worker's --key-secrets
flag currently causes an out of range panic. Always check to ensure
there's at least one element passed.

Fixes #130
Fixes #217
2015-12-16 20:28:21 -08:00

16 lines
388 B
Go

package db
import (
"testing"
)
func TestNewPrivateKeySetRepoInvalidKey(t *testing.T) {
_, err := NewPrivateKeySetRepo(nil, false, []byte("sharks"))
if err == nil {
t.Errorf("Expected non-nil error for key secret that was not 32 bytes")
}
_, err = NewPrivateKeySetRepo(nil, false)
if err == nil {
t.Fatalf("Expected non-nil error when creating repo with no key secrets")
}
}