2013-07-09 22:06:30 +00:00
|
|
|
|
using System.Net;
|
2013-04-20 22:14:41 +00:00
|
|
|
|
using FluentAssertions;
|
2013-04-19 04:46:18 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Api.Series;
|
2013-04-22 03:18:08 +00:00
|
|
|
|
using System.Linq;
|
2013-09-01 00:38:40 +00:00
|
|
|
|
using NzbDrone.Test.Common;
|
2013-04-19 04:46:18 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Integration.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-04-22 03:18:08 +00:00
|
|
|
|
public class SeriesIntegrationTest : IntegrationTest
|
2013-04-19 04:46:18 +00:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void series_lookup_on_trakt()
|
|
|
|
|
{
|
|
|
|
|
var series = Series.Lookup("archer");
|
|
|
|
|
|
|
|
|
|
series.Should().NotBeEmpty();
|
|
|
|
|
series.Should().Contain(c => c.Title == "Archer (2009)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2013-04-20 22:14:41 +00:00
|
|
|
|
public void add_series_without_required_fields_should_return_badrequest()
|
2013-04-19 04:46:18 +00:00
|
|
|
|
{
|
2013-04-20 22:14:41 +00:00
|
|
|
|
var errors = Series.InvalidPost(new SeriesResource());
|
|
|
|
|
errors.Should().NotBeEmpty();
|
2013-04-19 04:46:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-22 03:18:08 +00:00
|
|
|
|
[Test]
|
2013-04-24 01:56:00 +00:00
|
|
|
|
public void should_be_able_to_add_and_delete_series()
|
2013-04-22 03:18:08 +00:00
|
|
|
|
{
|
|
|
|
|
var series = Series.Lookup("archer").First();
|
|
|
|
|
|
2013-04-28 00:25:28 +00:00
|
|
|
|
series.QualityProfileId = 1;
|
2013-09-01 00:38:40 +00:00
|
|
|
|
series.Path = @"C:\Test\Archer".AsOsAgnostic();
|
2013-04-22 07:21:39 +00:00
|
|
|
|
|
2013-04-28 00:25:28 +00:00
|
|
|
|
series = Series.Post(series);
|
2013-04-22 03:18:08 +00:00
|
|
|
|
|
|
|
|
|
Series.All().Should().HaveCount(1);
|
2013-04-24 01:56:00 +00:00
|
|
|
|
|
2013-05-04 02:42:11 +00:00
|
|
|
|
Series.Get(series.Id).Should().NotBeNull();
|
|
|
|
|
|
2013-04-24 01:56:00 +00:00
|
|
|
|
Series.Delete(series.Id);
|
|
|
|
|
|
|
|
|
|
Series.All().Should().BeEmpty();
|
2013-04-22 03:18:08 +00:00
|
|
|
|
}
|
2013-05-04 02:42:11 +00:00
|
|
|
|
|
2013-07-12 19:13:16 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
2013-08-02 00:12:31 +00:00
|
|
|
|
public void should_be_able_to_find_series_by_id()
|
2013-07-12 19:13:16 +00:00
|
|
|
|
{
|
2013-08-02 00:12:31 +00:00
|
|
|
|
var series = Series.Lookup("90210").First();
|
2013-07-12 19:13:16 +00:00
|
|
|
|
|
|
|
|
|
series.QualityProfileId = 1;
|
2013-09-01 00:38:40 +00:00
|
|
|
|
series.Path = @"C:\Test\90210".AsOsAgnostic();
|
2013-07-12 19:13:16 +00:00
|
|
|
|
|
|
|
|
|
series = Series.Post(series);
|
|
|
|
|
|
|
|
|
|
Series.All().Should().HaveCount(1);
|
|
|
|
|
|
|
|
|
|
Series.Get(series.Id).Should().NotBeNull();
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-04 02:42:11 +00:00
|
|
|
|
|
2013-05-04 20:29:24 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void invalid_id_should_return_404()
|
|
|
|
|
{
|
|
|
|
|
Series.Get(99, HttpStatusCode.NotFound);
|
|
|
|
|
}
|
2013-04-19 04:46:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|