@@ -1561,16 +1561,19 @@ func TestAdminCheckUsernameAvailable(t *testing.T) {
15611561 t .Fatalf ("expected http status %d, got %d: %s" , http .StatusOK , rec .Code , rec .Body .String ())
15621562 }
15631563
1564+ // Nothing more to check, test is done.
15641565 if tc .wantOK {
1565- b := make (map [string ]bool , 1 )
1566- _ = json .NewDecoder (rec .Body ).Decode (& b )
1567- available , ok := b ["available" ]
1568- if ! ok {
1569- t .Fatal ("'available' not found in body" )
1570- }
1571- if available != tc .isAvailable {
1572- t .Fatalf ("expected 'available' to be %t, got %t instead" , tc .isAvailable , available )
1573- }
1566+ return
1567+ }
1568+
1569+ b := make (map [string ]bool , 1 )
1570+ _ = json .NewDecoder (rec .Body ).Decode (& b )
1571+ available , ok := b ["available" ]
1572+ if ! ok {
1573+ t .Fatal ("'available' not found in body" )
1574+ }
1575+ if available != tc .isAvailable {
1576+ t .Fatalf ("expected 'available' to be %t, got %t instead" , tc .isAvailable , available )
15741577 }
15751578 })
15761579 }
@@ -2311,7 +2314,7 @@ func TestAdminRetrieveAccount(t *testing.T) {
23112314 }
23122315
23132316 for _ , tc := range testCase {
2314- t .Run ("Retrieve existing account" , func (t * testing.T ) {
2317+ t .Run (tc . Name , func (t * testing.T ) {
23152318 req := test .NewRequest (t , http .MethodGet , "/_synapse/admin/v2/users/" + tc .User .ID )
23162319 req .Header .Set ("Authorization" , "Bearer " + adminToken )
23172320
0 commit comments