test: add setup key UUID format validation

This commit is contained in:
braginini 2021-08-20 15:08:07 +02:00
parent 1b056ab75a
commit 22fdb0a029

View File

@ -1,6 +1,7 @@
package server
import (
"github.com/google/uuid"
"testing"
"time"
)
@ -91,4 +92,9 @@ func assertKey(t *testing.T, key *SetupKey, expectedName string, expectedRevoke
if key.CreatedAt.Sub(expectedCreatedAt).Round(time.Hour) != 0 {
t.Errorf("expected setup key to have CreatedAt ~ %v, got %v", expectedCreatedAt, key.CreatedAt)
}
_, err := uuid.Parse(key.Key)
if err != nil {
t.Errorf("expected key to be a valid UUID, got %v, %v", key.Key, err)
}
}