blob: 8cb3cde2b616dcc06a28b31a0f09bb98f4715110 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using Jellyfin.Api.Controllers;
using Jellyfin.Server.Implementations.SystemBackupService;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Model.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;
namespace Jellyfin.Api.Tests.Controllers
{
public class SystemControllerTests
{
[Fact]
public void GetLogFile_FileDoesNotExist_ReturnsNotFound()
{
var mockFileSystem = new Mock<IFileSystem>();
mockFileSystem
.Setup(fs => fs.GetFiles(It.IsAny<string>(), It.IsAny<bool>()))
.Returns([new() { Name = "file1.txt" }, new() { Name = "file2.txt" }]);
var controller = new SystemController(
Mock.Of<ILogger<SystemController>>(),
Mock.Of<IServerApplicationHost>(),
Mock.Of<IServerApplicationPaths>(),
mockFileSystem.Object,
Mock.Of<INetworkManager>(),
Mock.Of<ISystemManager>());
var result = controller.GetLogFile("DOES_NOT_EXIST.txt");
Assert.IsType<NotFoundObjectResult>(result);
}
}
}
|