From 043212712d2eb7f0d73f55690b0da27316c2d7ce Mon Sep 17 00:00:00 2001 From: Flaminel Date: Tue, 27 Oct 2026 10:36:41 +0200 Subject: [PATCH] added lidarr client null body tests --- .../Features/Arr/LidarrClientTests.cs | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/code/backend/Cleanuparr.Infrastructure.Tests/Features/Arr/LidarrClientTests.cs b/code/backend/Cleanuparr.Infrastructure.Tests/Features/Arr/LidarrClientTests.cs index 4ba74e84..24dbd191 100644 --- a/code/backend/Cleanuparr.Infrastructure.Tests/Features/Arr/LidarrClientTests.cs +++ b/code/backend/Cleanuparr.Infrastructure.Tests/Features/Arr/LidarrClientTests.cs @@ -324,6 +324,19 @@ public class LidarrClientTests request.RequestUri!.AbsolutePath.ShouldBe("/api/v1/tag"); } + [Fact] + public async Task GetAllTagsAsync_NullBody_ReturnsEmpty() + { + // Arrange + _httpMessageHandler.SetupResponse((_, _) => Task.FromResult(JsonNullResponse())); + + // Act + List tags = await _client.GetAllTagsAsync(_arrInstance); + + // Assert + tags.ShouldBeEmpty(); + } + #endregion #region StreamAllArtistsAsync / GetQualityProfilesAsync @@ -397,6 +410,19 @@ public class LidarrClientTests request.RequestUri!.AbsolutePath.ShouldBe("/api/v1/qualityprofile"); } + [Fact] + public async Task GetQualityProfilesAsync_NullBody_ReturnsEmpty() + { + // Arrange + _httpMessageHandler.SetupResponse((_, _) => Task.FromResult(JsonNullResponse())); + + // Act + List profiles = await _client.GetQualityProfilesAsync(_arrInstance); + + // Assert + profiles.ShouldBeEmpty(); + } + #endregion #region GetAlbumsAsync / GetTrackFilesAsync @@ -432,6 +458,19 @@ public class LidarrClientTests albums[1].Statistics.ShouldBeNull(); } + [Fact] + public async Task GetAlbumsAsync_NullBody_ReturnsEmpty() + { + // Arrange + _httpMessageHandler.SetupResponse((_, _) => Task.FromResult(JsonNullResponse())); + + // Act + List albums = await _client.GetAlbumsAsync(_arrInstance, 7); + + // Assert + albums.ShouldBeEmpty(); + } + [Fact] public async Task GetTrackFilesAsync_BuildsArtistQueryAndDeserializesScores() { @@ -454,6 +493,19 @@ public class LidarrClientTests file.CustomFormatScore.ShouldBe(-5); } + [Fact] + public async Task GetTrackFilesAsync_NullBody_ReturnsEmpty() + { + // Arrange + _httpMessageHandler.SetupResponse((_, _) => Task.FromResult(JsonNullResponse())); + + // Act + List files = await _client.GetTrackFilesAsync(_arrInstance, 7); + + // Assert + files.ShouldBeEmpty(); + } + #endregion #region GetRecentlyGrabbedAlbumIdsAsync