@@ -77,24 +77,25 @@ func TestEventAuth(t *testing.T) {
7777 getEventAuth := func (t * testing.T , eventID string , wantAuthEventIDs []string ) {
7878 t .Helper ()
7979 t .Logf ("/event_auth for %s - want %v" , eventID , wantAuthEventIDs )
80- resp , err := srv .FederationClient (deployment ).GetEventAuth (context .Background (), "hs1" , room .Version , roomID , eventID )
80+ eventAuthResp , err := srv .FederationClient (deployment ).GetEventAuth (context .Background (), "hs1" , room .Version , roomID , eventID )
8181 must .NotError (t , "failed to /event_auth" , err )
82- if len (resp .AuthEvents ) == 0 {
82+ if len (eventAuthResp .AuthEvents ) == 0 {
8383 t .Fatalf ("/event_auth returned 0 auth events" )
8484 }
85- if len (resp .AuthEvents ) != len (wantAuthEventIDs ) {
85+ gotAuthEvents := eventAuthResp .AuthEvents .UntrustedEvents (room .Version )
86+ if len (gotAuthEvents ) != len (wantAuthEventIDs ) {
8687 msg := "got:\n "
87- for _ , e := range resp . AuthEvents {
88+ for _ , e := range gotAuthEvents {
8889 msg += e .EventID () + " : " + string (e .JSON ()) + "\n \n "
8990 }
90- t .Fatalf ("got %d auth events, wanted %d.\n %s\n want: %s" , len (resp .AuthEvents ), len (wantAuthEventIDs ), msg , wantAuthEventIDs )
91+ t .Fatalf ("got %d valid auth events (%d total) , wanted %d.\n %s\n want: %s" , len (gotAuthEvents ), len ( eventAuthResp .AuthEvents ), len (wantAuthEventIDs ), msg , wantAuthEventIDs )
9192 }
9293 // make sure all the events match
9394 wantIDs := map [string ]bool {}
9495 for _ , id := range wantAuthEventIDs {
9596 wantIDs [id ] = true
9697 }
97- for _ , e := range resp . AuthEvents {
98+ for _ , e := range gotAuthEvents {
9899 delete (wantIDs , e .EventID ())
99100 }
100101 if len (wantIDs ) > 0 {
0 commit comments