- Introduced Telegram.Bot package for bot functionality. - Updated user management to include Telegram linking and blocking features. - Enhanced activation request handling with notifications via Telegram. - Added new database entities for Telegram link tokens and login requests. - Implemented traffic synchronization for client stats in the XuiPanelGateway. - Updated application structure to support new test projects and improved dependency injection for Telegram services.
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using PnvPanel.Domain.Audit;
|
|
using Xunit;
|
|
|
|
namespace PnvPanel.Domain.Tests.Audit;
|
|
|
|
public class AuditLogTests
|
|
{
|
|
[Fact]
|
|
public void Create_SetsAllFieldsAndCreatedAt()
|
|
{
|
|
var actorId = Guid.NewGuid();
|
|
|
|
var log = AuditLog.Create(actorId, "user.blocked", "AppUser", actorId.ToString(), "{\"reason\":\"abuse\"}", AuditSource.Web);
|
|
|
|
Assert.Equal(actorId, log.ActorId);
|
|
Assert.Equal("user.blocked", log.Action);
|
|
Assert.Equal("AppUser", log.TargetType);
|
|
Assert.Equal(actorId.ToString(), log.TargetId);
|
|
Assert.Equal("{\"reason\":\"abuse\"}", log.Metadata);
|
|
Assert.Equal(AuditSource.Web, log.Source);
|
|
Assert.True(log.CreatedAt <= DateTimeOffset.UtcNow);
|
|
}
|
|
|
|
[Fact]
|
|
public void Create_AllowsNullActorForSystemActions()
|
|
{
|
|
var log = AuditLog.Create(null, "node.healthcheck", "Node", Guid.NewGuid().ToString(), null, AuditSource.System);
|
|
|
|
Assert.Null(log.ActorId);
|
|
Assert.Equal(AuditSource.System, log.Source);
|
|
}
|
|
}
|