mirror of https://github.com/Ombi-app/Ombi
commit
f16b33c437
@ -1,48 +0,0 @@
|
||||
<!---
|
||||
|
||||
!! Please use the Support / bug report template, otherwise we will close the Github issue !!
|
||||
|
||||
Version 2.X is not supported anymore. Please don't open a issue for the 2.x version.
|
||||
See https://github.com/tidusjar/Ombi/issues/1455 for more information.
|
||||
|
||||
(Pleas submit a feature request over here: http://feathub.com/tidusjar/Ombi)
|
||||
|
||||
|
||||
--->
|
||||
|
||||
#### Ombi build Version:
|
||||
|
||||
V 3.0.XX
|
||||
|
||||
#### Update Branch:
|
||||
|
||||
Open Beta
|
||||
|
||||
#### Media Sever:
|
||||
|
||||
Plex/Emby
|
||||
|
||||
#### Media Server Version:
|
||||
|
||||
<!-- If appropriate --->
|
||||
|
||||
#### Operating System:
|
||||
|
||||
(Place text here)
|
||||
|
||||
|
||||
#### Ombi Applicable Logs (from `/logs/` directory or the Admin page):
|
||||
|
||||
```
|
||||
|
||||
(Logs go here. Don't remove the ' tags for showing your logs correctly. Please make sure you remove any personal information from the logs)
|
||||
|
||||
```
|
||||
|
||||
#### Problem Description:
|
||||
|
||||
(Place text here)
|
||||
|
||||
#### Reproduction Steps:
|
||||
|
||||
Please include any steps to reproduce the issue, this the request that is causing the problem etc.
|
@ -0,0 +1,37 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Logs (Logs directory where Ombi is located)**
|
||||
If applicable, a snippet of the logs that seems relevant to the bug if present.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
|
||||
**Ombi Version (please complete the following information):**
|
||||
- Version [e.g. 3.0.1158]
|
||||
- Media Server [e.g. Plex]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<AssemblyVersion>3.0.0.0</AssemblyVersion>
|
||||
<FileVersion>3.0.0.0</FileVersion>
|
||||
<Version></Version>
|
||||
<PackageVersion></PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ombi.Api\Ombi.Api.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using MockQueryable.Moq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Ombi.Core.Authentication;
|
||||
using Ombi.Core.Rule.Rules;
|
||||
using Ombi.Core.Rule.Rules.Request;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Entities.Requests;
|
||||
using Ombi.Store.Repository.Requests;
|
||||
using Ombi.Test.Common;
|
||||
|
||||
namespace Ombi.Core.Tests.Rule.Request
|
||||
{
|
||||
public class ExistingMovieRequestRuleTests
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ContextMock = new Mock<IMovieRequestRepository>();
|
||||
Rule = new ExistingMovieRequestRule(ContextMock.Object);
|
||||
}
|
||||
|
||||
|
||||
private ExistingMovieRequestRule Rule { get; set; }
|
||||
private Mock<IMovieRequestRepository> ContextMock { get; set; }
|
||||
|
||||
[Test]
|
||||
public async Task ExistingRequestRule_Movie_Has_Been_Requested_With_TheMovieDBId()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<MovieRequests>
|
||||
{
|
||||
new MovieRequests
|
||||
{
|
||||
TheMovieDbId = 1,
|
||||
RequestType = RequestType.Movie
|
||||
}
|
||||
}.AsQueryable().BuildMock().Object);
|
||||
var o = new MovieRequests
|
||||
{
|
||||
TheMovieDbId = 1,
|
||||
};
|
||||
var result = await Rule.Execute(o);
|
||||
|
||||
Assert.That(result.Success, Is.False);
|
||||
Assert.That(result.Message, Is.Not.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ExistingRequestRule_Movie_Has_Been_Requested_With_ImdbId()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<MovieRequests>
|
||||
{
|
||||
new MovieRequests
|
||||
{
|
||||
TheMovieDbId = 11111,
|
||||
ImdbId = 1.ToString(),
|
||||
RequestType = RequestType.Movie
|
||||
}
|
||||
}.AsQueryable().BuildMock().Object);
|
||||
var o = new MovieRequests
|
||||
{
|
||||
ImdbId = 1.ToString(),
|
||||
};
|
||||
var result = await Rule.Execute(o);
|
||||
|
||||
Assert.That(result.Success, Is.False);
|
||||
Assert.That(result.Message, Is.Not.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ExistingRequestRule_Movie_HasNot_Been_Requested()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<MovieRequests>
|
||||
{
|
||||
new MovieRequests
|
||||
{
|
||||
TheMovieDbId = 2,
|
||||
ImdbId = "2",
|
||||
RequestType = RequestType.Movie
|
||||
}
|
||||
}.AsQueryable().BuildMock().Object);
|
||||
var o = new MovieRequests
|
||||
{
|
||||
TheMovieDbId = 1,
|
||||
ImdbId = "1"
|
||||
};
|
||||
var result = await Rule.Execute(o);
|
||||
|
||||
Assert.That(result.Success, Is.True);
|
||||
Assert.That(result.Message, Is.Null.Or.Empty);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Ombi.Core.Models.Search;
|
||||
using Ombi.Core.Rule.Rules.Search;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
|
||||
namespace Ombi.Core.Tests.Rule.Search
|
||||
{
|
||||
public class LidarrAlbumCacheRuleTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ContextMock = new Mock<IExternalRepository<LidarrAlbumCache>>();
|
||||
Rule = new LidarrAlbumCacheRule(ContextMock.Object);
|
||||
|
||||
}
|
||||
|
||||
private LidarrAlbumCacheRule Rule { get; set; }
|
||||
private Mock<IExternalRepository<LidarrAlbumCache>> ContextMock { get; set; }
|
||||
|
||||
[Test]
|
||||
public async Task Should_Not_Be_Monitored_Or_Available()
|
||||
{
|
||||
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(request.Approved);
|
||||
Assert.False(request.Monitored);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Should_Be_Monitored_But_Not_Available()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<LidarrAlbumCache>
|
||||
{
|
||||
new LidarrAlbumCache
|
||||
{
|
||||
ForeignAlbumId = "abc",
|
||||
PercentOfTracks = 0
|
||||
}
|
||||
}.AsQueryable());
|
||||
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(request.Approved);
|
||||
Assert.True(request.Monitored);
|
||||
Assert.That(request.PartiallyAvailable, Is.EqualTo(false));
|
||||
Assert.That(request.Available, Is.EqualTo(false));
|
||||
Assert.That(request.FullyAvailable, Is.EqualTo(false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Should_Be_Monitored_And_Partly_Available()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<LidarrAlbumCache>
|
||||
{
|
||||
new LidarrAlbumCache
|
||||
{
|
||||
ForeignAlbumId = "abc",
|
||||
PercentOfTracks = 1
|
||||
}
|
||||
}.AsQueryable());
|
||||
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(request.Approved);
|
||||
Assert.True(request.Monitored);
|
||||
Assert.That(request.PartiallyAvailable, Is.EqualTo(true));
|
||||
Assert.That(request.Available, Is.EqualTo(false));
|
||||
Assert.That(request.FullyAvailable, Is.EqualTo(false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Should_Be_Monitored_And_Fully_Available()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<LidarrAlbumCache>
|
||||
{
|
||||
new LidarrAlbumCache
|
||||
{
|
||||
ForeignAlbumId = "abc",
|
||||
PercentOfTracks = 100
|
||||
}
|
||||
}.AsQueryable());
|
||||
var request = new SearchAlbumViewModel { ForeignAlbumId = "abc" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(request.Approved);
|
||||
Assert.True(request.Monitored);
|
||||
Assert.That(request.PartiallyAvailable, Is.EqualTo(false));
|
||||
Assert.That(request.FullyAvailable, Is.EqualTo(true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Should_Be_Monitored_And_Fully_Available_Casing()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<LidarrAlbumCache>
|
||||
{
|
||||
new LidarrAlbumCache
|
||||
{
|
||||
ForeignAlbumId = "abc",
|
||||
PercentOfTracks = 100
|
||||
}
|
||||
}.AsQueryable());
|
||||
var request = new SearchAlbumViewModel { ForeignAlbumId = "ABC" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(request.Approved);
|
||||
Assert.True(request.Monitored);
|
||||
Assert.That(request.PartiallyAvailable, Is.EqualTo(false));
|
||||
Assert.That(request.FullyAvailable, Is.EqualTo(true));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Ombi.Core.Models.Search;
|
||||
using Ombi.Core.Rule.Rules.Search;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
|
||||
namespace Ombi.Core.Tests.Rule.Search
|
||||
{
|
||||
public class LidarrArtistCacheRuleTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ContextMock = new Mock<IExternalRepository<LidarrArtistCache>>();
|
||||
Rule = new LidarrArtistCacheRule(ContextMock.Object);
|
||||
}
|
||||
|
||||
private LidarrArtistCacheRule Rule { get; set; }
|
||||
private Mock<IExternalRepository<LidarrArtistCache>> ContextMock { get; set; }
|
||||
|
||||
[Test]
|
||||
public async Task Should_Not_Be_Monitored()
|
||||
{
|
||||
var request = new SearchArtistViewModel { ForignArtistId = "abc" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.False(request.Monitored);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Should_Be_Monitored()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<LidarrArtistCache>
|
||||
{
|
||||
new LidarrArtistCache
|
||||
{
|
||||
ForeignArtistId = "abc",
|
||||
}
|
||||
}.AsQueryable());
|
||||
var request = new SearchArtistViewModel { ForignArtistId = "abc" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.True(request.Monitored);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public async Task Should_Be_Monitored_Casing()
|
||||
{
|
||||
ContextMock.Setup(x => x.GetAll()).Returns(new List<LidarrArtistCache>
|
||||
{
|
||||
new LidarrArtistCache
|
||||
{
|
||||
ForeignArtistId = "abc",
|
||||
}
|
||||
}.AsQueryable());
|
||||
var request = new SearchArtistViewModel { ForignArtistId = "ABC" };
|
||||
var result = await Rule.Execute(request);
|
||||
|
||||
Assert.True(result.Success);
|
||||
Assert.True(request.Monitored);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue