aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs2
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs58
-rw-r--r--tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs19
-rw-r--r--tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs2
4 files changed, 22 insertions, 59 deletions
diff --git a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs
index cedcaf9c0..b32ecf6ec 100644
--- a/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs
+++ b/tests/Jellyfin.Providers.Tests/Manager/MetadataServiceTests.cs
@@ -330,7 +330,7 @@ namespace Jellyfin.Providers.Tests.Manager
MetadataService<Movie, MovieInfo>.MergeBaseItemData(source, target, lockedFields, replaceData, false);
actualValue = target.People;
- return newValue?.Equals(actualValue) ?? actualValue is null;
+ return newValue?.SequenceEqual((IEnumerable<PersonInfo>)actualValue!) ?? actualValue is null;
}
/// <summary>
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs
index 0d2b488bc..1cf9e864d 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Data/SqliteItemRepositoryTests.cs
@@ -3,8 +3,10 @@ using System.Collections.Generic;
using AutoFixture;
using AutoFixture.AutoMoq;
using Emby.Server.Implementations.Data;
+using Jellyfin.Server.Implementations.Item;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using Microsoft.Extensions.Configuration;
using Moq;
@@ -18,7 +20,7 @@ namespace Jellyfin.Server.Implementations.Tests.Data
public const string MetaDataPath = "/meta/data/path";
private readonly IFixture _fixture;
- private readonly SqliteItemRepository _sqliteItemRepository;
+ private readonly BaseItemRepository _sqliteItemRepository;
public SqliteItemRepositoryTests()
{
@@ -40,7 +42,7 @@ namespace Jellyfin.Server.Implementations.Tests.Data
_fixture = new Fixture().Customize(new AutoMoqCustomization { ConfigureMembers = true });
_fixture.Inject(appHost);
_fixture.Inject(config);
- _sqliteItemRepository = _fixture.Create<SqliteItemRepository>();
+ _sqliteItemRepository = _fixture.Create<BaseItemRepository>();
}
public static TheoryData<string, ItemImageInfo> ItemImageInfoFromValueString_Valid_TestData()
@@ -101,7 +103,7 @@ namespace Jellyfin.Server.Implementations.Tests.Data
[MemberData(nameof(ItemImageInfoFromValueString_Valid_TestData))]
public void ItemImageInfoFromValueString_Valid_Success(string value, ItemImageInfo expected)
{
- var result = _sqliteItemRepository.ItemImageInfoFromValueString(value);
+ var result = _sqliteItemRepository.ItemImageInfoFromValueString(value)!;
Assert.Equal(expected.Path, result.Path);
Assert.Equal(expected.Type, result.Type);
Assert.Equal(expected.DateModified, result.DateModified);
@@ -243,56 +245,6 @@ namespace Jellyfin.Server.Implementations.Tests.Data
Assert.Equal(expected, _sqliteItemRepository.SerializeImages(value));
}
- public static TheoryData<string, Dictionary<string, string>> DeserializeProviderIds_Valid_TestData()
- {
- var data = new TheoryData<string, Dictionary<string, string>>();
-
- data.Add(
- "Imdb=tt0119567",
- new Dictionary<string, string>()
- {
- { "Imdb", "tt0119567" },
- });
-
- data.Add(
- "Imdb=tt0119567|Tmdb=330|TmdbCollection=328",
- new Dictionary<string, string>()
- {
- { "Imdb", "tt0119567" },
- { "Tmdb", "330" },
- { "TmdbCollection", "328" },
- });
-
- data.Add(
- "MusicBrainzAlbum=9d363e43-f24f-4b39-bc5a-7ef305c677c7|MusicBrainzReleaseGroup=63eba062-847c-3b73-8b0f-6baf27bba6fa|AudioDbArtist=111352|AudioDbAlbum=2116560|MusicBrainzAlbumArtist=20244d07-534f-4eff-b4d4-930878889970",
- new Dictionary<string, string>()
- {
- { "MusicBrainzAlbum", "9d363e43-f24f-4b39-bc5a-7ef305c677c7" },
- { "MusicBrainzReleaseGroup", "63eba062-847c-3b73-8b0f-6baf27bba6fa" },
- { "AudioDbArtist", "111352" },
- { "AudioDbAlbum", "2116560" },
- { "MusicBrainzAlbumArtist", "20244d07-534f-4eff-b4d4-930878889970" },
- });
-
- return data;
- }
-
- [Theory]
- [MemberData(nameof(DeserializeProviderIds_Valid_TestData))]
- public void DeserializeProviderIds_Valid_Success(string value, Dictionary<string, string> expected)
- {
- var result = new ProviderIdsExtensionsTestsObject();
- SqliteItemRepository.DeserializeProviderIds(value, result);
- Assert.Equal(expected, result.ProviderIds);
- }
-
- [Theory]
- [MemberData(nameof(DeserializeProviderIds_Valid_TestData))]
- public void SerializeProviderIds_Valid_Success(string expected, Dictionary<string, string> values)
- {
- Assert.Equal(expected, SqliteItemRepository.SerializeProviderIds(values));
- }
-
private sealed class ProviderIdsExtensionsTestsObject : IHasProviderIds
{
public Dictionary<string, string> ProviderIds { get; set; } = new Dictionary<string, string>();
diff --git a/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs b/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs
index bf3bfdad4..02a77516f 100644
--- a/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs
+++ b/tests/Jellyfin.Server.Integration.Tests/Controllers/LibraryStructureControllerTests.cs
@@ -13,7 +13,7 @@ using Xunit.Priority;
namespace Jellyfin.Server.Integration.Tests.Controllers;
-[TestCaseOrderer(PriorityOrderer.Name, PriorityOrderer.Assembly)]
+// [TestCaseOrderer(PriorityOrderer.Name, PriorityOrderer.Assembly)]
public sealed class LibraryStructureControllerTests : IClassFixture<JellyfinApplicationFactory>
{
private readonly JellyfinApplicationFactory _factory;
@@ -62,12 +62,23 @@ public sealed class LibraryStructureControllerTests : IClassFixture<JellyfinAppl
}
[Fact]
- [Priority(0)]
+ [Priority(-2)]
public async Task UpdateLibraryOptions_Valid_Success()
{
var client = _factory.CreateClient();
client.DefaultRequestHeaders.AddAuthHeader(_accessToken ??= await AuthHelper.CompleteStartupAsync(client));
+ var createBody = new AddVirtualFolderDto()
+ {
+ LibraryOptions = new LibraryOptions()
+ {
+ Enabled = false
+ }
+ };
+
+ using var createResponse = await client.PostAsJsonAsync("Library/VirtualFolders?name=test&refreshLibrary=true", createBody, _jsonOptions);
+ Assert.Equal(HttpStatusCode.NoContent, createResponse.StatusCode);
+
using var response = await client.GetAsync("Library/VirtualFolders");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
@@ -80,13 +91,13 @@ public sealed class LibraryStructureControllerTests : IClassFixture<JellyfinAppl
Assert.False(options.Enabled);
options.Enabled = true;
- var body = new UpdateLibraryOptionsDto()
+ var existBody = new UpdateLibraryOptionsDto()
{
Id = Guid.Parse(library.ItemId),
LibraryOptions = options
};
- using var response2 = await client.PostAsJsonAsync("Library/VirtualFolders/LibraryOptions", body, _jsonOptions);
+ using var response2 = await client.PostAsJsonAsync("Library/VirtualFolders/LibraryOptions", existBody, _jsonOptions);
Assert.Equal(HttpStatusCode.NoContent, response2.StatusCode);
}
diff --git a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
index 075c70da8..b9833c225 100644
--- a/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
+++ b/tests/Jellyfin.XbmcMetadata.Tests/Parsers/MovieNfoParserTests.cs
@@ -149,7 +149,7 @@ namespace Jellyfin.XbmcMetadata.Tests.Parsers
Assert.Equal(new DateTime(2019, 8, 6, 9, 1, 18), item.DateCreated);
// userData
- var userData = _userDataManager.GetUserData(_testUser, item);
+ var userData = _userDataManager.GetUserData(_testUser, item)!;
Assert.Equal(2, userData.PlayCount);
Assert.True(userData.Played);
Assert.Equal(new DateTime(2021, 02, 11, 07, 47, 23), userData.LastPlayedDate);