mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Correct tests for Jellyfin types
This commit is contained in:
parent
555406c1c4
commit
6b24ab7f83
3 changed files with 30 additions and 19 deletions
|
@ -30,7 +30,7 @@ namespace Ombi.Core.Tests.Authentication
|
||||||
AuthenticationSettings.Setup(x => x.GetSettingsAsync())
|
AuthenticationSettings.Setup(x => x.GetSettingsAsync())
|
||||||
.ReturnsAsync(new AuthenticationSettings());
|
.ReturnsAsync(new AuthenticationSettings());
|
||||||
_um = new OmbiUserManager(UserStore.Object, null, null, null, null, null, null, null, null,
|
_um = new OmbiUserManager(UserStore.Object, null, null, null, null, null, null, null, null,
|
||||||
PlexApi.Object, null, null, AuthenticationSettings.Object);
|
PlexApi.Object, null, null, null, null, AuthenticationSettings.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OmbiUserManager _um { get; set; }
|
public OmbiUserManager _um { get; set; }
|
||||||
|
|
|
@ -15,13 +15,6 @@ namespace Ombi.Helpers.Tests
|
||||||
return EmbyHelper.GetEmbyMediaUrl(mediaId, serverId, url);
|
return EmbyHelper.GetEmbyMediaUrl(mediaId, serverId, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCaseSource(nameof(JellyfinUrlData))]
|
|
||||||
public string TestJellyfinUrl(string mediaId, string url, string serverId)
|
|
||||||
{
|
|
||||||
// http://192.168.68.X:8097/web/index.html#!/details?id=7ffe222498445d5ebfddb31bc4fa9a6d&serverId=50cce67f0baa425093d189b3017331fb
|
|
||||||
return EmbyHelper.GetEmbyMediaUrl(mediaId, serverId, url, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IEnumerable<TestCaseData> UrlData
|
public static IEnumerable<TestCaseData> UrlData
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -33,16 +26,5 @@ namespace Ombi.Helpers.Tests
|
||||||
yield return new TestCaseData(mediaId.ToString(), string.Empty, "1").Returns($"https://app.emby.media/web/index.html#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithOutCustomDomain");
|
yield return new TestCaseData(mediaId.ToString(), string.Empty, "1").Returns($"https://app.emby.media/web/index.html#!/item?id={mediaId}&serverId=1").SetName("EmbyHelper_GetMediaUrl_WithOutCustomDomain");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<TestCaseData> JellyfinUrlData
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var mediaId = 1;
|
|
||||||
yield return new TestCaseData(mediaId.ToString(), "http://google.com", "1").Returns($"http://google.com/web/index.html#!/details?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
|
|
||||||
yield return new TestCaseData(mediaId.ToString(), "http://google.com/", "1").Returns($"http://google.com/web/index.html#!/details?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain");
|
|
||||||
yield return new TestCaseData(mediaId.ToString(), "https://google.com/", "1").Returns($"https://google.com/web/index.html#!/details?id={mediaId}&serverId=1").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_Https");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
29
src/Ombi.Helpers.Tests/JellyfinHelperTests.cs
Normal file
29
src/Ombi.Helpers.Tests/JellyfinHelperTests.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ombi.Helpers.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class EmbyHelperTests
|
||||||
|
{
|
||||||
|
[TestCaseSource(nameof(UrlData))]
|
||||||
|
public string TestUrl(string mediaId, string url, string serverId)
|
||||||
|
{
|
||||||
|
// http://192.168.68.X:8097/web/index.html#!/details?id=7ffe222498445d5ebfddb31bc4fa9a6d&serverId=50cce67f0baa425093d189b3017331fb
|
||||||
|
return JellyfinHelper.GetJellyfinMediaUrl(mediaId, serverId, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<TestCaseData> UrlData
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var mediaId = 1;
|
||||||
|
yield return new TestCaseData(mediaId.ToString(), "http://google.com", "1").Returns($"http://google.com/web/index.html#!/item?id={mediaId}&serverId=1").SetName("JellyfinHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
|
||||||
|
yield return new TestCaseData(mediaId.ToString(), "http://google.com/", "1").Returns($"http://google.com/web/index.html#!/item?id={mediaId}&serverId=1").SetName("JellyfinHelper_GetMediaUrl_WithCustomDomain");
|
||||||
|
yield return new TestCaseData(mediaId.ToString(), "https://google.com/", "1").Returns($"https://google.com/web/index.html#!/item?id={mediaId}&serverId=1").SetName("JellyfinHelper_GetMediaUrl_WithCustomDomain_Https");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue