MCPcopy Create free account
hub / github.com/daodst/chat / TestServersRequestOwnKeys

Function TestServersRequestOwnKeys

federationapi/federationapi_keys_test.go:144–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestServersRequestOwnKeys(t *testing.T) {
145 // Each server will request its own keys. There's no reason
146 // for this to fail as each server should know its own keys.
147
148 for name, s := range servers {
149 req := gomatrixserverlib.PublicKeyLookupRequest{
150 ServerName: s.name,
151 KeyID: serverKeyID,
152 }
153 res, err := s.api.FetchKeys(
154 context.Background(),
155 map[gomatrixserverlib.PublicKeyLookupRequest]gomatrixserverlib.Timestamp{
156 req: gomatrixserverlib.AsTimestamp(time.Now()),
157 },
158 )
159 if err != nil {
160 t.Fatalf("server could not fetch own key: %s", err)
161 }
162 if _, ok := res[req]; !ok {
163 t.Fatalf("server didn't return its own key in the results")
164 }
165 t.Logf("%s's key expires at %s\n", name, res[req].ValidUntilTS.Time())
166 }
167}
168
169func TestRenewalBehaviour(t *testing.T) {
170 // Server A will request Server C's key but their validity period

Callers

nothing calls this directly

Calls 1

FetchKeysMethod · 0.45

Tested by

no test coverage detected