Skip to content

Commit 4433ba9

Browse files
committed
Enhance PoliciesControllerTests to verify error messages for BadRequest responses by checking for specific field names in the response content.
1 parent 3aaaf0e commit 4433ba9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/Api.IntegrationTest/AdminConsole/Controllers/PoliciesControllerTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ public async Task Put_MasterPasswordPolicy_InvalidDataType_ReturnsBadRequest()
233233

234234
// Assert
235235
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
236+
var content = await response.Content.ReadAsStringAsync();
237+
Assert.Contains("minLength", content); // Verify field name is in error message
236238
}
237239

238240
[Fact]
@@ -306,6 +308,8 @@ public async Task PutVNext_MasterPasswordPolicy_InvalidDataType_ReturnsBadReques
306308

307309
// Assert
308310
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
311+
var content = await response.Content.ReadAsStringAsync();
312+
Assert.Contains("minComplexity", content); // Verify field name is in error message
309313
}
310314

311315
[Fact]

0 commit comments

Comments
 (0)