/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/teams/identify_test.go
72 строки
2 KB
zoom-ua
remove golang.org/x/net/context in favor of context (#28708)
17 дек 2025, 18:24
Не верифицирован
17 дек 2025, 18:24
67b0ffe
Код
Авторство
О чём код?
package teams import ( "context" "testing" "github.com/keybase/client/go/libkb" "github.com/keybase/client/go/protocol/keybase1" ) func TestIdentifyLite(t *testing.T) { tc, _, name := memberSetup(t) defer tc.Cleanup() team, err := GetForTestByStringName(context.Background(), tc.G, name) if err != nil { t.Fatal(err) } // test identify by assertion only assertions := []string{"team:" + name, "tid:" + team.ID.String()} for _, assertion := range assertions { au, err := libkb.ParseAssertionURL(tc.G.MakeAssertionContext(libkb.NewMetaContext(context.Background(), tc.G)), assertion, true) if err != nil { t.Fatal(err) } res, err := IdentifyLite(context.Background(), tc.G, keybase1.IdentifyLiteArg{Assertion: assertion}, au) if err != nil { t.Fatal(err) } if res.Ul.Name != name { t.Errorf("assertion: %s, id lite name: %s, expected %s", assertion, res.Ul.Name, name) } if res.Ul.Id.String() != team.ID.String() { t.Errorf("assertion: %s, id lite id: %s, expected %s", assertion, res.Ul.Id, team.ID) } } // test identify by id and assertions for _, assertion := range assertions { au, err := libkb.ParseAssertionURL(tc.G.MakeAssertionContext(libkb.NewMetaContext(context.Background(), tc.G)), assertion, true) if err != nil { t.Fatal(err) } res, err := IdentifyLite(context.Background(), tc.G, keybase1.IdentifyLiteArg{Id: team.ID.AsUserOrTeam(), Assertion: assertion}, au) if err != nil { t.Fatal(err) } if res.Ul.Name != name { t.Errorf("assertion: %s, id lite name: %s, expected %s", assertion, res.Ul.Name, name) } if res.Ul.Id.String() != team.ID.String() { t.Errorf("assertion: %s, id lite id: %s, expected %s", assertion, res.Ul.Id, team.ID) } } // test identify by id only var empty libkb.AssertionKeybase res, err := IdentifyLite(context.Background(), tc.G, keybase1.IdentifyLiteArg{Id: team.ID.AsUserOrTeam()}, empty) if err != nil { t.Fatal(err) } if res.Ul.Name != name { t.Errorf("id lite name: %s, expected %s", res.Ul.Name, name) } if res.Ul.Id.String() != team.ID.String() { t.Errorf("id lite id: %s, expected %s", res.Ul.Id, team.ID) } }