added slug integration tests

This commit is contained in:
Keivan Beigi 2013-05-03 19:42:11 -07:00
parent 8373e1ce10
commit 54d95e2e20
5 changed files with 27 additions and 1 deletions

View File

@ -46,6 +46,13 @@ namespace NzbDrone.Integration.Test.Client
return Post<TResource>(request); return Post<TResource>(request);
} }
public TResource Get(int id, HttpStatusCode statusCode = HttpStatusCode.OK)
{
var request = BuildRequest(id.ToString());
return Get<TResource>(request, statusCode);
}
public void Delete(int id) public void Delete(int id)
{ {
var request = BuildRequest(id.ToString()); var request = BuildRequest(id.ToString());

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Net;
using NzbDrone.Api.Series; using NzbDrone.Api.Series;
using RestSharp; using RestSharp;
@ -18,5 +19,12 @@ namespace NzbDrone.Integration.Test.Client
return Get<List<SeriesResource>>(request); return Get<List<SeriesResource>>(request);
} }
public SeriesResource Get(string slug, HttpStatusCode statusCode = HttpStatusCode.OK)
{
var request = BuildRequest(slug);
return Get<SeriesResource>(request, statusCode);
}
} }
} }

View File

@ -69,7 +69,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Client\ClientBase.cs" /> <Compile Include="Client\ClientBase.cs" />
<Compile Include="Client\IndexerClient.cs" /> <Compile Include="Client\IndexerClient.cs" />
<Compile Include="Client\SeriesClient - Copy.cs" /> <Compile Include="Client\ReleaseClient.cs" />
<Compile Include="Client\SeriesClient.cs" /> <Compile Include="Client\SeriesClient.cs" />
<Compile Include="CommandIntegerationTests.cs" /> <Compile Include="CommandIntegerationTests.cs" />
<Compile Include="IndexerIntegrationFixture.cs" /> <Compile Include="IndexerIntegrationFixture.cs" />

View File

@ -47,9 +47,20 @@ namespace NzbDrone.Integration.Test
Series.All().Should().HaveCount(1); Series.All().Should().HaveCount(1);
Series.Get(series.Id).Should().NotBeNull();
Series.Get(series.TitleSlug).Should().NotBeNull();
Series.Delete(series.Id); Series.Delete(series.Id);
Series.All().Should().BeEmpty(); Series.All().Should().BeEmpty();
} }
[Test]
public void wrong_slug_should_return_404()
{
Series.Get("non-existing-slug", HttpStatusCode.NotFound);
}
} }
} }