From 4ddc5996689f664175daf974fe8e56250a9e4919 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 9 Sep 2013 22:39:18 -0700 Subject: [PATCH] added history integration test --- .../Client/ClientBase.cs | 12 +++++++++++ .../CommandIntegerationTests.cs | 1 + .../HistoryIntegrationTest.cs | 21 +++++++++++++++++++ NzbDrone.Integration.Test/IntegrationTest.cs | 3 +++ .../NzbDrone.Integration.Test.csproj | 1 + 5 files changed, 38 insertions(+) create mode 100644 NzbDrone.Integration.Test/HistoryIntegrationTest.cs diff --git a/NzbDrone.Integration.Test/Client/ClientBase.cs b/NzbDrone.Integration.Test/Client/ClientBase.cs index 05ca16711..16aff68eb 100644 --- a/NzbDrone.Integration.Test/Client/ClientBase.cs +++ b/NzbDrone.Integration.Test/Client/ClientBase.cs @@ -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>(request); } + public PagingResource 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>(request); + + } + public TResource Post(TResource body) { var request = BuildRequest(); diff --git a/NzbDrone.Integration.Test/CommandIntegerationTests.cs b/NzbDrone.Integration.Test/CommandIntegerationTests.cs index af3342c2b..cfd89178e 100644 --- a/NzbDrone.Integration.Test/CommandIntegerationTests.cs +++ b/NzbDrone.Integration.Test/CommandIntegerationTests.cs @@ -9,6 +9,7 @@ using RestSharp; namespace NzbDrone.Integration.Test { [TestFixture] + [Ignore] public class CommandIntegrationTest : IntegrationTest { [Test] diff --git a/NzbDrone.Integration.Test/HistoryIntegrationTest.cs b/NzbDrone.Integration.Test/HistoryIntegrationTest.cs new file mode 100644 index 000000000..0fce0d308 --- /dev/null +++ b/NzbDrone.Integration.Test/HistoryIntegrationTest.cs @@ -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(); + } + + } +} \ No newline at end of file diff --git a/NzbDrone.Integration.Test/IntegrationTest.cs b/NzbDrone.Integration.Test/IntegrationTest.cs index b858e4ff3..562b24175 100644 --- a/NzbDrone.Integration.Test/IntegrationTest.cs +++ b/NzbDrone.Integration.Test/IntegrationTest.cs @@ -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 RootFolders; protected ClientBase Commands; protected ReleaseClient Releases; + protected ClientBase 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(RestClient); Commands = new ClientBase(RestClient); + History = new ClientBase(RestClient); Indexers = new IndexerClient(RestClient); Episodes = new EpisodeClient(RestClient); Seasons = new SeasonClient(RestClient); diff --git a/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj b/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj index 5762f6877..040fd500b 100644 --- a/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj +++ b/NzbDrone.Integration.Test/NzbDrone.Integration.Test.csproj @@ -100,6 +100,7 @@ +