aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzerafachris <christopher.zerafa@blocklabs.io>2026-07-21 08:51:30 +0200
committerzerafachris <christopher.zerafa@blocklabs.io>2026-07-21 08:51:30 +0200
commit53e58d8b1b61c44405322bf91a8aa230f02b8323 (patch)
tree0df6968ae31244a37842be71c7e0b0c987b2ed34
parent5cd3d7ebb7c8ce5b7cf68b0696543780215a6fff (diff)
Make ItemUpdateController.UpdateItem internal instead of reflection
Addresses review feedback from @Bond-009 on PR #17370: the test helper InvokeUpdateItem was invoking the private UpdateItem(BaseItemDto, BaseItem) method via reflection. Jellyfin.Api.csproj already grants InternalsVisibleTo("Jellyfin.Api.Tests"), so the method is changed to internal and the test now calls it directly, removing the GetMethod/Invoke boilerplate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
-rw-r--r--Jellyfin.Api/Controllers/ItemUpdateController.cs2
-rw-r--r--tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs12
2 files changed, 2 insertions, 12 deletions
diff --git a/Jellyfin.Api/Controllers/ItemUpdateController.cs b/Jellyfin.Api/Controllers/ItemUpdateController.cs
index b0ea1dd911..65f53a23ff 100644
--- a/Jellyfin.Api/Controllers/ItemUpdateController.cs
+++ b/Jellyfin.Api/Controllers/ItemUpdateController.cs
@@ -236,7 +236,7 @@ public class ItemUpdateController : BaseJellyfinApiController
return NoContent();
}
- private async Task UpdateItem(BaseItemDto request, BaseItem item)
+ internal async Task UpdateItem(BaseItemDto request, BaseItem item)
{
item.Name = request.Name;
item.ForcedSortName = request.ForcedSortName;
diff --git a/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs b/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs
index fa167203dd..1a91efe4f2 100644
--- a/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs
+++ b/tests/Jellyfin.Api.Tests/Controllers/ItemUpdateControllerTests.cs
@@ -1,5 +1,4 @@
using System;
-using System.Reflection;
using System.Threading.Tasks;
using Jellyfin.Api.Controllers;
using MediaBrowser.Controller.Configuration;
@@ -73,15 +72,6 @@ public class ItemUpdateControllerTests
private Task InvokeUpdateItem(BaseItemDto request, BaseItem item)
{
- var method = typeof(ItemUpdateController).GetMethod(
- "UpdateItem",
- BindingFlags.NonPublic | BindingFlags.Instance,
- null,
- new[] { typeof(BaseItemDto), typeof(BaseItem) },
- null);
-
- Assert.NotNull(method);
-
- return (Task)method!.Invoke(_subject, new object[] { request, item })!;
+ return _subject.UpdateItem(request, item);
}
}