added history integration test

pull/4/head
kay.one 11 years ago
parent c7bdf4148b
commit 4ddc599668

@ -2,6 +2,7 @@
using System.Net;
using FluentAssertions;
using NLog;
using NzbDrone.Api;
using NzbDrone.Api.REST;
using NzbDrone.Common.Serializer;
using RestSharp;
@ -35,6 +36,17 @@ namespace NzbDrone.Integration.Test.Client
return Get<List<TResource>>(request);
}
public PagingResource<TResource> GetPaged(int pageNumber, int pageSize, string sortKey, string sortDir)
{
var request = BuildRequest();
request.AddParameter("page", pageNumber);
request.AddParameter("pageSize", pageSize);
request.AddParameter("sortKey", sortKey);
request.AddParameter("sortDir", sortDir);
return Get<PagingResource<TResource>>(request);
}
public TResource Post(TResource body)
{
var request = BuildRequest();

@ -9,6 +9,7 @@ using RestSharp;
namespace NzbDrone.Integration.Test
{
[TestFixture]
[Ignore]
public class CommandIntegrationTest : IntegrationTest
{
[Test]

@ -0,0 +1,21 @@
using FluentAssertions;
using NUnit.Framework;
namespace NzbDrone.Integration.Test
{
[TestFixture]
public class HistoryIntegrationTest : IntegrationTest
{
[Test]
public void history_should_be_empty()
{
var history = History.GetPaged(1,15,"date","desc");
history.Records.Count.Should().Be(0);
history.Page.Should().Be(1);
history.PageSize.Should().Be(15);
history.Records.Should().BeEmpty();
}
}
}

@ -5,6 +5,7 @@ using NLog.Targets;
using NUnit.Framework;
using NzbDrone.Api.Commands;
using NzbDrone.Api.Config;
using NzbDrone.Api.History;
using NzbDrone.Api.RootFolders;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Integration.Test.Client;
@ -23,6 +24,7 @@ namespace NzbDrone.Integration.Test
protected ClientBase<RootFolderResource> RootFolders;
protected ClientBase<CommandResource> Commands;
protected ReleaseClient Releases;
protected ClientBase<HistoryResource> History;
protected IndexerClient Indexers;
protected EpisodeClient Episodes;
protected SeasonClient Seasons;
@ -59,6 +61,7 @@ namespace NzbDrone.Integration.Test
Releases = new ReleaseClient(RestClient);
RootFolders = new ClientBase<RootFolderResource>(RestClient);
Commands = new ClientBase<CommandResource>(RestClient);
History = new ClientBase<HistoryResource>(RestClient);
Indexers = new IndexerClient(RestClient);
Episodes = new EpisodeClient(RestClient);
Seasons = new SeasonClient(RestClient);

@ -100,6 +100,7 @@
<Compile Include="Client\ReleaseClient.cs" />
<Compile Include="Client\SeriesClient.cs" />
<Compile Include="CommandIntegerationTests.cs" />
<Compile Include="HistoryIntegrationTest.cs" />
<Compile Include="NamingConfigTests.cs" />
<Compile Include="SeasonIntegrationTests.cs" />
<Compile Include="EpisodeIntegrationTests.cs" />

Loading…
Cancel
Save