mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-24 19:52:39 +01:00
Switch Integration Tests to V3 API
This commit is contained in:
parent
b819246655
commit
fdecd1fea4
@ -1,6 +1,7 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Series;
|
||||
using Sonarr.Api.V3.Blocklist;
|
||||
using Sonarr.Api.V3.Series;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
@ -15,7 +16,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
_series = EnsureSeries(266189, "The Blacklist");
|
||||
|
||||
Blocklist.Post(new Api.Blocklist.BlocklistResource
|
||||
Blocklist.Post(new BlocklistResource
|
||||
{
|
||||
SeriesId = _series.Id,
|
||||
SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
||||
|
@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Episodes;
|
||||
using Sonarr.Api.V3.Episodes;
|
||||
using NzbDrone.Integration.Test.Client;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Commands;
|
||||
using Sonarr.Api.V3.Commands;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.DiskSpace;
|
||||
using Sonarr.Api.V3.DiskSpace;
|
||||
using NzbDrone.Integration.Test.Client;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Threading;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Series;
|
||||
using Sonarr.Api.V3.Series;
|
||||
using System.Linq;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
var newSeries = Series.Lookup("archer").Single(c => c.TvdbId == 110381);
|
||||
|
||||
newSeries.ProfileId = 1;
|
||||
newSeries.QualityProfileId = 1;
|
||||
newSeries.LanguageProfileId = 1;
|
||||
newSeries.Path = @"C:\Test\Archer".AsOsAgnostic();
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
using FluentAssertions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Indexers;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using Sonarr.Http.ClientSchema;
|
||||
|
||||
@ -28,7 +28,8 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
schema.Name = name;
|
||||
schema.EnableRss = false;
|
||||
schema.EnableSearch = false;
|
||||
schema.EnableAutomaticSearch = false;
|
||||
schema.EnableInteractiveSearch = false;
|
||||
|
||||
return schema;
|
||||
}
|
||||
@ -39,7 +40,8 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
schema.Name = name;
|
||||
schema.EnableRss = false;
|
||||
schema.EnableSearch = false;
|
||||
schema.EnableAutomaticSearch = false;
|
||||
schema.EnableInteractiveSearch = false;
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Indexers;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Indexers;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using System.Net;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.RootFolders;
|
||||
using Sonarr.Api.V3.RootFolders;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
var newSeries = Series.Lookup(title).First();
|
||||
|
||||
newSeries.ProfileId = 1;
|
||||
newSeries.QualityProfileId = 1;
|
||||
newSeries.LanguageProfileId = 1;
|
||||
newSeries.Path = string.Format(@"C:\Test\{0}", title).AsOsAgnostic();
|
||||
|
||||
@ -31,13 +31,13 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
foreach (var s in series)
|
||||
{
|
||||
s.ProfileId = 2;
|
||||
s.QualityProfileId = 2;
|
||||
}
|
||||
|
||||
var result = Series.Editor(series);
|
||||
|
||||
result.Should().HaveCount(2);
|
||||
result.TrueForAll(s => s.ProfileId == 2).Should().BeTrue();
|
||||
result.TrueForAll(s => s.QualityProfileId == 2).Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
var series = Series.Lookup("tvdb:266189").Single();
|
||||
|
||||
series.ProfileId = 1;
|
||||
series.QualityProfileId = 1;
|
||||
series.LanguageProfileId = 1;
|
||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
||||
series.Tags = new HashSet<int>();
|
||||
@ -48,7 +48,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
var series = Series.Lookup("tvdb:266189").Single();
|
||||
|
||||
series.ProfileId = 1;
|
||||
series.QualityProfileId = 1;
|
||||
|
||||
Series.InvalidPost(series);
|
||||
}
|
||||
@ -60,7 +60,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
var series = Series.Lookup("tvdb:266189").Single();
|
||||
|
||||
series.ProfileId = 1;
|
||||
series.QualityProfileId = 1;
|
||||
series.LanguageProfileId = 1;
|
||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
||||
|
||||
@ -68,7 +68,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.Id.Should().NotBe(0);
|
||||
result.ProfileId.Should().Be(1);
|
||||
result.QualityProfileId.Should().Be(1);
|
||||
result.LanguageProfileId.Should().Be(1);
|
||||
result.Path.Should().Be(Path.Combine(SeriesRootFolder, series.Title));
|
||||
}
|
||||
@ -107,16 +107,16 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||
var series = EnsureSeries(266189, "The Blacklist");
|
||||
|
||||
var profileId = 1;
|
||||
if (series.ProfileId == profileId)
|
||||
if (series.QualityProfileId == profileId)
|
||||
{
|
||||
profileId = 2;
|
||||
}
|
||||
|
||||
series.ProfileId = profileId;
|
||||
series.QualityProfileId = profileId;
|
||||
|
||||
var result = Series.Put(series);
|
||||
|
||||
Series.Get(series.Id).ProfileId.Should().Be(profileId);
|
||||
Series.Get(series.Id).QualityProfileId.Should().Be(profileId);
|
||||
}
|
||||
|
||||
[Test, Order(3)]
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Net;
|
||||
using FluentAssertions;
|
||||
using NLog;
|
||||
using NzbDrone.Api;
|
||||
using Sonarr.Http.REST;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using RestSharp;
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.Commands;
|
||||
using Sonarr.Api.V3.Commands;
|
||||
using RestSharp;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using FluentAssertions;
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.DownloadClient;
|
||||
using Sonarr.Api.V3.DownloadClient;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Episodes;
|
||||
using Sonarr.Api.V3.Episodes;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Indexers;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Api.Notifications;
|
||||
using Sonarr.Api.V3.Notifications;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.Indexers;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -1,4 +1,4 @@
|
||||
using NzbDrone.Api.Indexers;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using NzbDrone.Api.Series;
|
||||
using Sonarr.Api.V3.Series;
|
||||
using RestSharp;
|
||||
|
||||
namespace NzbDrone.Integration.Test.Client
|
||||
|
@ -2,6 +2,7 @@ using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using Sonarr.Api.V3.Series;
|
||||
|
||||
namespace NzbDrone.Integration.Test
|
||||
{
|
||||
@ -20,7 +21,7 @@ namespace NzbDrone.Integration.Test
|
||||
var logFile = "sonarr.trace.txt";
|
||||
var logLines = Logs.GetLogFileLines(logFile);
|
||||
|
||||
var resultPost = Series.InvalidPost(new Api.Series.SeriesResource());
|
||||
var resultPost = Series.InvalidPost(new SeriesResource());
|
||||
|
||||
// Skip 2 and 1 to ignore the logs endpoint
|
||||
logLines = Logs.GetLogFileLines(logFile).Skip(logLines.Length + 2).ToArray();
|
||||
|
@ -1,6 +1,7 @@
|
||||
using NLog;
|
||||
using NzbDrone.Core.Indexers.Newznab;
|
||||
using NzbDrone.Test.Common;
|
||||
using Sonarr.Api.V3.Indexers;
|
||||
using Sonarr.Http.ClientSchema;
|
||||
|
||||
namespace NzbDrone.Integration.Test
|
||||
@ -25,10 +26,11 @@ namespace NzbDrone.Integration.Test
|
||||
|
||||
protected override void InitializeTestTarget()
|
||||
{
|
||||
Indexers.Post(new Api.Indexers.IndexerResource
|
||||
Indexers.Post(new IndexerResource
|
||||
{
|
||||
EnableRss = false,
|
||||
EnableSearch = false,
|
||||
EnableAutomaticSearch = false,
|
||||
EnableInteractiveSearch = false,
|
||||
ConfigContract = nameof(NewznabSettings),
|
||||
Implementation = nameof(Newznab),
|
||||
Name = "NewznabTest",
|
||||
|
@ -11,17 +11,17 @@ using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Api.Blocklist;
|
||||
using NzbDrone.Api.Commands;
|
||||
using NzbDrone.Api.Config;
|
||||
using NzbDrone.Api.DownloadClient;
|
||||
using NzbDrone.Api.EpisodeFiles;
|
||||
using NzbDrone.Api.Episodes;
|
||||
using NzbDrone.Api.History;
|
||||
using NzbDrone.Api.Profiles;
|
||||
using NzbDrone.Api.RootFolders;
|
||||
using NzbDrone.Api.Series;
|
||||
using NzbDrone.Api.Tags;
|
||||
using Sonarr.Api.V3.Blocklist;
|
||||
using Sonarr.Api.V3.Commands;
|
||||
using Sonarr.Api.V3.Config;
|
||||
using Sonarr.Api.V3.DownloadClient;
|
||||
using Sonarr.Api.V3.EpisodeFiles;
|
||||
using Sonarr.Api.V3.Episodes;
|
||||
using Sonarr.Api.V3.History;
|
||||
using Sonarr.Api.V3.Profiles.Quality;
|
||||
using Sonarr.Api.V3.RootFolders;
|
||||
using Sonarr.Api.V3.Series;
|
||||
using Sonarr.Api.V3.Tags;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Qualities;
|
||||
@ -50,7 +50,7 @@ namespace NzbDrone.Integration.Test
|
||||
public LogsClient Logs;
|
||||
public ClientBase<NamingConfigResource> NamingConfig;
|
||||
public NotificationClient Notifications;
|
||||
public ClientBase<ProfileResource> Profiles;
|
||||
public ClientBase<QualityProfileResource> Profiles;
|
||||
public ReleaseClient Releases;
|
||||
public ReleasePushClient ReleasePush;
|
||||
public ClientBase<RootFolderResource> RootFolders;
|
||||
@ -117,7 +117,7 @@ namespace NzbDrone.Integration.Test
|
||||
Logs = new LogsClient(RestClient, ApiKey);
|
||||
NamingConfig = new ClientBase<NamingConfigResource>(RestClient, ApiKey, "config/naming");
|
||||
Notifications = new NotificationClient(RestClient, ApiKey);
|
||||
Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
|
||||
Profiles = new ClientBase<QualityProfileResource>(RestClient, ApiKey);
|
||||
Releases = new ReleaseClient(RestClient, ApiKey);
|
||||
ReleasePush = new ReleasePushClient(RestClient, ApiKey);
|
||||
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
|
||||
@ -236,7 +236,7 @@ namespace NzbDrone.Integration.Test
|
||||
{
|
||||
var lookup = Series.Lookup("tvdb:" + tvdbId);
|
||||
var series = lookup.First();
|
||||
series.ProfileId = 1;
|
||||
series.QualityProfileId = 1;
|
||||
series.LanguageProfileId = 1;
|
||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
||||
series.Monitored = true;
|
||||
@ -308,14 +308,14 @@ namespace NzbDrone.Integration.Test
|
||||
return result.EpisodeFile;
|
||||
}
|
||||
|
||||
public ProfileResource EnsureProfileCutoff(int profileId, Quality cutoff, bool upgradeAllowed)
|
||||
public QualityProfileResource EnsureProfileCutoff(int profileId, Quality cutoff, bool upgradeAllowed)
|
||||
{
|
||||
var needsUpdate = false;
|
||||
var profile = Profiles.Get(profileId);
|
||||
|
||||
if (profile.Cutoff != cutoff)
|
||||
if (profile.Cutoff != cutoff.Id)
|
||||
{
|
||||
profile.Cutoff = cutoff;
|
||||
profile.Cutoff = cutoff.Id;
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,8 @@
|
||||
<PackageReference Include="Microsoft.AspNet.SignalR.Client" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NzbDrone.Api\Sonarr.Api.csproj" />
|
||||
<ProjectReference Include="..\NzbDrone.Test.Common\Sonarr.Test.Common.csproj" />
|
||||
<ProjectReference Include="..\Sonarr.Api.V3\Sonarr.Api.V3.csproj" />
|
||||
<ProjectReference Include="..\Sonarr.Http\Sonarr.Http.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -5,10 +5,8 @@ using Nancy.Bootstrapper;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using Sonarr.Http.ErrorManagement;
|
||||
using Sonarr.Http.Extensions;
|
||||
using Sonarr.Http.Extensions.Pipelines;
|
||||
|
||||
namespace NzbDrone.Api.Extensions.Pipelines
|
||||
namespace Sonarr.Http.Extensions.Pipelines
|
||||
{
|
||||
public class RequestLoggingPipeline : IRegisterNancyPipeline
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user