mirror of
https://github.com/Radarr/Radarr
synced 2026-01-30 11:22:22 +01:00
Fixed: All integration tests and some code which was wrong. (#3604)
* Fixed: All integration tests and some code which was wrong. * Hopefully fix Movie Fixture issues. * Fixed: HttpFixture. Took commit from sonarr.
This commit is contained in:
parent
8e43f5c4ae
commit
b5e1b83de3
9 changed files with 105 additions and 77 deletions
|
|
@ -154,9 +154,9 @@ workflows:
|
|||
- unit_tests:
|
||||
requires:
|
||||
- build
|
||||
#- integration_tests:
|
||||
# requires:
|
||||
# - build
|
||||
- integration_tests:
|
||||
requires:
|
||||
- build
|
||||
- publish_artifacts:
|
||||
requires:
|
||||
- build
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ private PagingResource<MovieResource> GetCutoffUnmetMovies(PagingResource<MovieR
|
|||
|
||||
pagingSpec.FilterExpression = _movieService.ConstructFilterExpression(pagingResource.FilterKey, pagingResource.FilterValue);
|
||||
|
||||
if (pagingResource.FilterKey == null)
|
||||
{
|
||||
pagingSpec.FilterExpression = m => m.Monitored == true;
|
||||
}
|
||||
|
||||
var resource = ApplyToPage(_movieCutoffService.MoviesWhereCutoffUnmet, pagingSpec, v => MapToResource(v, true));
|
||||
|
||||
return resource;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ class MovieMissingModule : MovieModuleWithSignalR
|
|||
{
|
||||
protected readonly IMovieService _movieService;
|
||||
|
||||
public MovieMissingModule(IMovieService movieService,
|
||||
IQualityUpgradableSpecification qualityUpgradableSpecification,
|
||||
IBroadcastSignalRMessage signalRBroadcaster)
|
||||
public MovieMissingModule(IMovieService movieService,
|
||||
IQualityUpgradableSpecification qualityUpgradableSpecification,
|
||||
IBroadcastSignalRMessage signalRBroadcaster)
|
||||
: base(movieService, qualityUpgradableSpecification, signalRBroadcaster, "wanted/missing")
|
||||
{
|
||||
|
||||
|
|
@ -30,6 +30,10 @@ private PagingResource<MovieResource> GetMissingMovies(PagingResource<MovieResou
|
|||
var pagingSpec = pagingResource.MapToPagingSpec<MovieResource, Core.Movies.Movie>("title", SortDirection.Descending);
|
||||
|
||||
pagingSpec.FilterExpression = _movieService.ConstructFilterExpression(pagingResource.FilterKey, pagingResource.FilterValue);
|
||||
if (pagingResource.FilterKey != "monitored")
|
||||
{
|
||||
pagingSpec.FilterExpression = m => m.Monitored == true;
|
||||
}
|
||||
|
||||
var resource = ApplyToPage(_movieService.MoviesWithoutFiles, pagingSpec, v => MapToResource(v, true));
|
||||
|
||||
|
|
|
|||
|
|
@ -68,11 +68,12 @@ public void should_execute_https_get()
|
|||
[Test]
|
||||
public void should_execute_typed_get()
|
||||
{
|
||||
var request = new HttpRequest(string.Format("http://{0}/get", _httpBinHost));
|
||||
var request = new HttpRequest(string.Format("http://{0}/get?test=1", _httpBinHost));
|
||||
|
||||
var response = Subject.Get<HttpBinResource>(request);
|
||||
|
||||
response.Resource.Url.Should().Be(request.Url.FullUri);
|
||||
response.Resource.Url.EndsWith("/get?test=1");
|
||||
response.Resource.Args.Should().Contain("test", "1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -514,7 +515,7 @@ public void should_delete_temp_response_cookie()
|
|||
public void should_not_send_old_cookie()
|
||||
{
|
||||
GivenOldCookie();
|
||||
|
||||
|
||||
var requestCookies = new HttpRequest($"http://{_httpBinHost}/cookies");
|
||||
requestCookies.IgnorePersistentCookies = true;
|
||||
requestCookies.StoreRequestCookie = false;
|
||||
|
|
@ -626,6 +627,7 @@ public void should_reject_malformed_domain_cookie(string malformedCookie)
|
|||
|
||||
public class HttpBinResource
|
||||
{
|
||||
public Dictionary<string, object> Args { get; set; }
|
||||
public Dictionary<string, object> Headers { get; set; }
|
||||
public string Origin { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
[TestFixture]
|
||||
[Ignore("Not ready to be used on this branch")]
|
||||
public class CommandFixture : IntegrationTest
|
||||
{
|
||||
[Test]
|
||||
|
|
@ -16,4 +15,4 @@ public void should_be_able_to_run_rss_sync()
|
|||
response.Id.Should().NotBe(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,41 +3,11 @@
|
|||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class WantedFixture : IntegrationTest
|
||||
public class CutoffUnmetFixture : IntegrationTest
|
||||
{
|
||||
[Test, Order(0)]
|
||||
public void missing_should_be_empty()
|
||||
{
|
||||
EnsureNoMovie(680, "Pulp Fiction");
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_monitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_movie()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_have_monitored_items()
|
||||
{
|
||||
|
|
@ -50,16 +20,6 @@ public void cutoff_should_have_monitored_items()
|
|||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_not_have_unmonitored_items()
|
||||
{
|
||||
|
|
@ -84,16 +44,6 @@ public void cutoff_should_have_movie()
|
|||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "false");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void cutoff_should_have_unmonitored_items()
|
||||
{
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MissingFixture : IntegrationTest
|
||||
{
|
||||
[Test, Order(0)]
|
||||
public void missing_should_be_empty()
|
||||
{
|
||||
EnsureNoMovie(680, "Pulp Fiction");
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_monitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_movie()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "false");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,6 +235,8 @@ public MovieResource EnsureMovie(int tmdbid, string movieTitle, bool? monitored
|
|||
}
|
||||
}
|
||||
|
||||
Commands.WaitAll();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -254,9 +256,13 @@ public MovieFileResource EnsureMovieFile(MovieResource movie, Quality quality)
|
|||
|
||||
if (result.MovieFile == null)
|
||||
{
|
||||
var path = Path.Combine(MovieRootFolder, movie.Title, string.Format("{0} - {1}.mkv", movie.Title, quality.Name));
|
||||
var path = Path.Combine(MovieRootFolder, movie.Title, string.Format("{0} ({1}) - {2}.strm", movie.Title, movie.Year, quality.Name));
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
var sourcePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "ApiTests", "Files", "H264_sample.mp4");
|
||||
|
||||
//File.Copy(sourcePath, path);
|
||||
File.WriteAllText(path, "Fake Movie");
|
||||
|
||||
Commands.PostAndWait(new CommandResource { Name = "refreshmovie", Body = new RefreshMovieCommand(movie.Id) });
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@
|
|||
<Compile Include="ApiTests\MovieFileFixture.cs" />
|
||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||
<Compile Include="ApiTests\MovieLookupFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedTests\CutoffUnmetFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedTests\MissingFixture.cs" />
|
||||
<Compile Include="Client\ClientBase.cs" />
|
||||
<Compile Include="Client\IndexerClient.cs" />
|
||||
<Compile Include="Client\DownloadClientClient.cs" />
|
||||
|
|
@ -180,20 +181,20 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent Condition="('$(OS)' == 'Windows_NT')">
|
||||
xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Mono.*" "$(TargetDir)"
|
||||
xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Windows.*" "$(TargetDir)"
|
||||
<PostBuildEvent Condition="('$(OS)' == 'Windows_NT')">
|
||||
xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Mono.*" "$(TargetDir)"
|
||||
xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Windows.*" "$(TargetDir)"
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition="('$(OS)' != 'Windows_NT')">
|
||||
cp -rv $(SolutionDir)\..\_output\NzbDrone.Mono.* $(TargetDir)
|
||||
cp -rv $(SolutionDir)\..\_output\NzbDrone.Windows.* $(TargetDir)
|
||||
<PostBuildEvent Condition="('$(OS)' != 'Windows_NT')">
|
||||
cp -rv $(SolutionDir)\..\_output\NzbDrone.Mono.* $(TargetDir)
|
||||
cp -rv $(SolutionDir)\..\_output\NzbDrone.Windows.* $(TargetDir)
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Loading…
Reference in a new issue