AuthControllerTests

This commit is contained in:
Artemy
2025-06-25 14:08:54 +07:00
parent 06cee5caae
commit e40489db40
5 changed files with 226 additions and 11 deletions
+6 -2
View File
@@ -1,7 +1,6 @@
using Govor.API.Services;
using Govor.API.Services.Authentication;
using Govor.Core.DTOs;
using Govor.API.Services.Authentication.Interfaces;
using Govor.Core.Requests;
using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers;
@@ -75,6 +74,11 @@ public class AuthController : Controller
_logger.LogWarning(ex, "Login failed for user {Name}", userRequest.Name);
return BadRequest("Login failed: user does not exist.");
}
catch (LoginUserException ex)
{
_logger.LogWarning(ex, "Login failed for user {Name}", userRequest.Name);
return BadRequest("Login failed: username or password is incorrect.");
}
catch (Exception ex)
{
_logger.LogError(ex, "Unexpected error during login for user {Name}", userRequest.Name);