diff --git a/.circleci/config.yml b/.circleci/config.yml index 784ffe329..0b9a446ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -154,9 +154,9 @@ workflows: - unit_tests: requires: - build - #- integration_tests: - # requires: - # - build + - integration_tests: + requires: + - build - publish_artifacts: requires: - build diff --git a/src/NzbDrone.Api/Wanted/MovieCutoffModule.cs b/src/NzbDrone.Api/Wanted/MovieCutoffModule.cs index f032f0b12..8478ab071 100644 --- a/src/NzbDrone.Api/Wanted/MovieCutoffModule.cs +++ b/src/NzbDrone.Api/Wanted/MovieCutoffModule.cs @@ -26,6 +26,11 @@ namespace NzbDrone.Api.Wanted 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; diff --git a/src/NzbDrone.Api/Wanted/MovieMissingModule.cs b/src/NzbDrone.Api/Wanted/MovieMissingModule.cs index e4b1868b2..68b2c934a 100644 --- a/src/NzbDrone.Api/Wanted/MovieMissingModule.cs +++ b/src/NzbDrone.Api/Wanted/MovieMissingModule.cs @@ -15,9 +15,9 @@ namespace NzbDrone.Api.Wanted { 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 @@ namespace NzbDrone.Api.Wanted var pagingSpec = pagingResource.MapToPagingSpec("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)); diff --git a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs index 07b45c222..d64a52942 100644 --- a/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs +++ b/src/NzbDrone.Common.Test/Http/HttpClientFixture.cs @@ -68,11 +68,12 @@ namespace NzbDrone.Common.Test.Http [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(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 @@ namespace NzbDrone.Common.Test.Http 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 @@ namespace NzbDrone.Common.Test.Http public class HttpBinResource { + public Dictionary Args { get; set; } public Dictionary Headers { get; set; } public string Origin { get; set; } public string Url { get; set; } diff --git a/src/NzbDrone.Integration.Test/ApiTests/CommandFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/CommandFixture.cs index bf17b6d12..6acbc6650 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/CommandFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/CommandFixture.cs @@ -5,7 +5,6 @@ using NzbDrone.Api.Commands; namespace NzbDrone.Integration.Test.ApiTests { [TestFixture] - [Ignore("Not ready to be used on this branch")] public class CommandFixture : IntegrationTest { [Test] @@ -16,4 +15,4 @@ namespace NzbDrone.Integration.Test.ApiTests response.Id.Should().NotBe(0); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Integration.Test/ApiTests/WantedFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs similarity index 53% rename from src/NzbDrone.Integration.Test/ApiTests/WantedFixture.cs rename to src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs index 12b1cad0d..a2c7a2edf 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/WantedFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs @@ -3,41 +3,11 @@ using FluentAssertions; 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 @@ namespace NzbDrone.Integration.Test.ApiTests 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 @@ namespace NzbDrone.Integration.Test.ApiTests 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() { diff --git a/src/NzbDrone.Integration.Test/ApiTests/WantedTests/MissingFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/WantedTests/MissingFixture.cs new file mode 100644 index 000000000..d13301ae6 --- /dev/null +++ b/src/NzbDrone.Integration.Test/ApiTests/WantedTests/MissingFixture.cs @@ -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(); + } + } +} diff --git a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs index d96cd5935..7b1f86278 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs @@ -235,6 +235,8 @@ namespace NzbDrone.Integration.Test } } + Commands.WaitAll(); + return result; } @@ -254,9 +256,13 @@ namespace NzbDrone.Integration.Test 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) }); diff --git a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj index 7e6d7de48..2a9077d59 100644 --- a/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj +++ b/src/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj @@ -113,7 +113,8 @@ - + + @@ -180,20 +181,20 @@ - - xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Mono.*" "$(TargetDir)" - xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Windows.*" "$(TargetDir)" + + xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Mono.*" "$(TargetDir)" + xcopy /s /y "$(SolutionDir)\..\_output\NzbDrone.Windows.*" "$(TargetDir)" - - cp -rv $(SolutionDir)\..\_output\NzbDrone.Mono.* $(TargetDir) - cp -rv $(SolutionDir)\..\_output\NzbDrone.Windows.* $(TargetDir) + + cp -rv $(SolutionDir)\..\_output\NzbDrone.Mono.* $(TargetDir) + cp -rv $(SolutionDir)\..\_output\NzbDrone.Windows.* $(TargetDir) - \ No newline at end of file