1package winio 2 3import "testing" 4 5func TestLookupInvalidSid(t *testing.T) { 6 _, err := LookupSidByName(".\\weoifjdsklfj") 7 aerr, ok := err.(*AccountLookupError) 8 if !ok || aerr.Err != cERROR_NONE_MAPPED { 9 t.Fatalf("expected AccountLookupError with ERROR_NONE_MAPPED, got %s", err) 10 } 11} 12 13func TestLookupValidSid(t *testing.T) { 14 sid, err := LookupSidByName("Everyone") 15 if err != nil || sid != "S-1-1-0" { 16 t.Fatalf("expected S-1-1-0, got %s, %s", sid, err) 17 } 18} 19 20func TestLookupEmptyNameFails(t *testing.T) { 21 _, err := LookupSidByName(".\\weoifjdsklfj") 22 aerr, ok := err.(*AccountLookupError) 23 if !ok || aerr.Err != cERROR_NONE_MAPPED { 24 t.Fatalf("expected AccountLookupError with ERROR_NONE_MAPPED, got %s", err) 25 } 26} 27