aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2024-02-28 17:09:23 -0700
committerGitHub <noreply@github.com>2024-02-28 17:09:23 -0700
commitf3c333f4d5bb272b5ffcff29af337ca31e8c374b (patch)
tree008525e157be39a25e013fd3b039d4680760eb68 /tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs
parent54eb81395ef8d3d4cb064b56361ce94fc72b38b5 (diff)
parent4f0f364ac941dc4a856512c9bf0e6b93fdf7b3ab (diff)
Merge branch 'master' into bhowe34/fix-replace-missing-metadata-for-music
Diffstat (limited to 'tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs')
-rw-r--r--tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs
new file mode 100644
index 000000000..dd84c1a18
--- /dev/null
+++ b/tests/Jellyfin.Api.Tests/Controllers/SystemControllerTests.cs
@@ -0,0 +1,35 @@
+using Jellyfin.Api.Controllers;
+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);
+ }
+ }
+}