[AZ-199] [AZ-200] [AZ-201] [AZ-202] Fix API bugs

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-16 06:55:11 +03:00
parent 5286b6b8e3
commit 88c7b288df
9 changed files with 71 additions and 38 deletions
+10 -10
View File
@@ -32,7 +32,7 @@ public sealed class UserManagementTests
try
{
// Arrange
var body = new { email, password = "SecurePass1", role = 10 };
var body = new { email, password = "SecurePass1!", role = 10 };
// Act
using var response = await client.PostAsync("/users", body);
@@ -87,7 +87,7 @@ public sealed class UserManagementTests
try
{
// Arrange
using (var createResp = await client.PostAsync("/users", new { email, password = "SecurePass1", role = 10 }))
using (var createResp = await client.PostAsync("/users", new { email, password = "SecurePass1!", role = 10 }))
{
createResp.StatusCode.Should().BeOneOf(HttpStatusCode.OK, HttpStatusCode.NoContent);
}
@@ -112,7 +112,7 @@ public sealed class UserManagementTests
try
{
// Arrange
using (var createResp = await client.PostAsync("/users", new { email, password = "SecurePass1", role = 10 }))
using (var createResp = await client.PostAsync("/users", new { email, password = "SecurePass1!", role = 10 }))
{
createResp.StatusCode.Should().BeOneOf(HttpStatusCode.OK, HttpStatusCode.NoContent);
}
@@ -137,7 +137,7 @@ public sealed class UserManagementTests
try
{
// Arrange
using (var createResp = await client.PostAsync("/users", new { email, password = "SecurePass1", role = 10 }))
using (var createResp = await client.PostAsync("/users", new { email, password = "SecurePass1!", role = 10 }))
{
createResp.StatusCode.Should().BeOneOf(HttpStatusCode.OK, HttpStatusCode.NoContent);
}
@@ -160,7 +160,7 @@ public sealed class UserManagementTests
}
}
[Fact(Skip = "API bug: no email length validation — returns 200 instead of 400")]
[Fact]
public async Task Registration_rejects_short_email_with_400()
{
// Arrange
@@ -168,13 +168,13 @@ public sealed class UserManagementTests
// Act
using var response = await client.PostAsync("/users",
new { email = "ab@c.de", password = "ValidPass1", role = 10 });
new { email = "ab@c.de", password = "ValidPass123", role = 10 });
// Assert
response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
}
[Fact(Skip = "API bug: no email format validation — returns 200 instead of 400")]
[Fact]
public async Task Registration_rejects_invalid_email_format_with_400()
{
// Arrange
@@ -182,13 +182,13 @@ public sealed class UserManagementTests
// Act
using var response = await client.PostAsync("/users",
new { email = "notavalidemail", password = "ValidPass1", role = 10 });
new { email = "notavalidemail", password = "ValidPass123", role = 10 });
// Assert
response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
}
[Fact(Skip = "API bug: no password length validation — returns 200 instead of 400")]
[Fact]
public async Task Registration_rejects_short_password_with_400()
{
// Arrange
@@ -210,7 +210,7 @@ public sealed class UserManagementTests
// Act
using var response = await client.PostAsync("/users",
new { email = _fixture.AdminEmail, password = "DuplicateP1", role = 10 });
new { email = _fixture.AdminEmail, password = "DuplicateP1!", role = 10 });
// Assert
response.StatusCode.Should().Be(HttpStatusCode.Conflict);