chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package identity
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPrincipalContext(t *testing.T) {
|
||||
if _, ok := PrincipalFromContext(context.Background()); ok {
|
||||
t.Fatal("empty context should not contain a principal")
|
||||
}
|
||||
expected := Principal{Issuer: "issuer", Subject: "subject"}
|
||||
actual, ok := PrincipalFromContext(WithPrincipal(context.Background(), expected))
|
||||
if !ok || actual != expected {
|
||||
t.Fatalf("principal = %#v, %t, want %#v", actual, ok, expected)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user