mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Fixed unit tests
This commit is contained in:
parent
68411e680c
commit
3a82562341
4 changed files with 24 additions and 7 deletions
|
@ -18,7 +18,7 @@ namespace Ombi.Core.Tests.Rule.Request
|
||||||
{
|
{
|
||||||
private List<OmbiUser> _users = new List<OmbiUser>
|
private List<OmbiUser> _users = new List<OmbiUser>
|
||||||
{
|
{
|
||||||
new OmbiUser { Id = Guid.NewGuid().ToString("N"), UserName="abc" }
|
new OmbiUser { Id = Guid.NewGuid().ToString("N"), UserName="abc",UserType = UserType.LocalUser}
|
||||||
};
|
};
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Ombi.Core.Tests.Rule.Request
|
||||||
{
|
{
|
||||||
private List<OmbiUser> _users = new List<OmbiUser>
|
private List<OmbiUser> _users = new List<OmbiUser>
|
||||||
{
|
{
|
||||||
new OmbiUser { Id = Guid.NewGuid().ToString("N"), UserName="abc" }
|
new OmbiUser { Id = Guid.NewGuid().ToString("N"), UserName="abc", UserType = UserType.LocalUser}
|
||||||
};
|
};
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace Ombi.Core.Tests.Rule.Search
|
||||||
var result = await Rule.Execute(search);
|
var result = await Rule.Execute(search);
|
||||||
|
|
||||||
Assert.True(result.Success);
|
Assert.True(result.Success);
|
||||||
Assert.That(search.EmbyUrl, Is.EqualTo("http://test.com/#!/itemdetails.html?id=1"));
|
Assert.That(search.EmbyUrl, Is.EqualTo("http://test.com/#!/item/item.html?id=1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -99,7 +99,7 @@ namespace Ombi.Core.Tests.Rule.Search
|
||||||
var result = await Rule.Execute(search);
|
var result = await Rule.Execute(search);
|
||||||
|
|
||||||
Assert.True(result.Success);
|
Assert.True(result.Success);
|
||||||
Assert.That(search.EmbyUrl, Is.EqualTo("https://app.emby.media/#!/itemdetails.html?id=1"));
|
Assert.That(search.EmbyUrl, Is.EqualTo("https://app.emby.media/#!/item/item.html?id=1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -14,14 +14,31 @@ namespace Ombi.Helpers.Tests
|
||||||
return EmbyHelper.GetEmbyMediaUrl(mediaId, url);
|
return EmbyHelper.GetEmbyMediaUrl(mediaId, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCaseSource(nameof(JellyfinUrlData))]
|
||||||
|
public string TestJellyfinUrl(string mediaId, string url)
|
||||||
|
{
|
||||||
|
return EmbyHelper.GetEmbyMediaUrl(mediaId, url, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<TestCaseData> UrlData
|
public static IEnumerable<TestCaseData> UrlData
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var mediaId = 1;
|
var mediaId = 1;
|
||||||
yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
|
yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/item/item.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
|
||||||
yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain");
|
yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/item/item.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain");
|
||||||
yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https");
|
yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/item/item.html?id={mediaId}").SetName("EmbyHelper_GetMediaUrl_WithCustomDomain_Https");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<TestCaseData> JellyfinUrlData
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var mediaId = 1;
|
||||||
|
yield return new TestCaseData(mediaId.ToString(), "http://google.com").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_WithoutTrailingSlash");
|
||||||
|
yield return new TestCaseData(mediaId.ToString(), "http://google.com/").Returns($"http://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain");
|
||||||
|
yield return new TestCaseData(mediaId.ToString(), "https://google.com/").Returns($"https://google.com/#!/itemdetails.html?id={mediaId}").SetName("EmbyHelperJellyfin_GetMediaUrl_WithCustomDomain_Https");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue