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.
Leonardo Galli 5 years ago committed by GitHub
parent 8e43f5c4ae
commit b5e1b83de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 @@ 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;

@ -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<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 @@ 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<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 @@ 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<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 @@ 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);
}
}
}
}

@ -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()
{

@ -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 @@ 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) });

@ -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…
Cancel
Save