msc3861: cr fixes

This commit is contained in:
Roman Isaev 2025-02-12 16:13:32 +00:00
parent 8df644263c
commit 3eb4c7e1bd
No known key found for this signature in database
GPG key ID: 7BE2B6A6C89AEC7F
6 changed files with 36 additions and 39 deletions

View file

@ -1561,16 +1561,19 @@ func TestAdminCheckUsernameAvailable(t *testing.T) {
t.Fatalf("expected http status %d, got %d: %s", http.StatusOK, rec.Code, rec.Body.String())
}
// Nothing more to check, test is done.
if tc.wantOK {
b := make(map[string]bool, 1)
_ = json.NewDecoder(rec.Body).Decode(&b)
available, ok := b["available"]
if !ok {
t.Fatal("'available' not found in body")
}
if available != tc.isAvailable {
t.Fatalf("expected 'available' to be %t, got %t instead", tc.isAvailable, available)
}
return
}
b := make(map[string]bool, 1)
_ = json.NewDecoder(rec.Body).Decode(&b)
available, ok := b["available"]
if !ok {
t.Fatal("'available' not found in body")
}
if available != tc.isAvailable {
t.Fatalf("expected 'available' to be %t, got %t instead", tc.isAvailable, available)
}
})
}
@ -2311,7 +2314,7 @@ func TestAdminRetrieveAccount(t *testing.T) {
}
for _, tc := range testCase {
t.Run("Retrieve existing account", func(t *testing.T) {
t.Run(tc.Name, func(t *testing.T) {
req := test.NewRequest(t, http.MethodGet, "/_synapse/admin/v2/users/"+tc.User.ID)
req.Header.Set("Authorization", "Bearer "+adminToken)