2013-07-10 00:06:30 +02:00
|
|
|
|
using System.Net;
|
2013-04-21 00:14:41 +02:00
|
|
|
|
using FluentAssertions;
|
2013-04-19 06:46:18 +02:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Api.Series;
|
2013-04-22 05:18:08 +02:00
|
|
|
|
using System.Linq;
|
2013-04-19 06:46:18 +02:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Integration.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-04-22 05:18:08 +02:00
|
|
|
|
public class SeriesIntegrationTest : IntegrationTest
|
2013-04-19 06:46:18 +02:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_have_no_series_on_start_application()
|
|
|
|
|
{
|
2013-04-22 05:18:08 +02:00
|
|
|
|
Series.All().Should().BeEmpty();
|
2013-04-19 06:46:18 +02: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-21 00:14:41 +02:00
|
|
|
|
public void add_series_without_required_fields_should_return_badrequest()
|
2013-04-19 06:46:18 +02:00
|
|
|
|
{
|
2013-04-21 00:14:41 +02:00
|
|
|
|
var errors = Series.InvalidPost(new SeriesResource());
|
|
|
|
|
errors.Should().NotBeEmpty();
|
2013-04-19 06:46:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-22 05:18:08 +02:00
|
|
|
|
[Test]
|
2013-04-24 03:56:00 +02:00
|
|
|
|
public void should_be_able_to_add_and_delete_series()
|
2013-04-22 05:18:08 +02:00
|
|
|
|
{
|
|
|
|
|
var series = Series.Lookup("archer").First();
|
|
|
|
|
|
2013-04-28 02:25:28 +02:00
|
|
|
|
series.QualityProfileId = 1;
|
2013-05-24 06:10:56 +02:00
|
|
|
|
series.Path = @"C:\Test\Archer";
|
2013-04-22 09:21:39 +02:00
|
|
|
|
|
2013-04-28 02:25:28 +02:00
|
|
|
|
series = Series.Post(series);
|
2013-04-22 05:18:08 +02:00
|
|
|
|
|
|
|
|
|
Series.All().Should().HaveCount(1);
|
2013-04-24 03:56:00 +02:00
|
|
|
|
|
2013-05-04 04:42:11 +02:00
|
|
|
|
Series.Get(series.Id).Should().NotBeNull();
|
|
|
|
|
Series.Get(series.TitleSlug).Should().NotBeNull();
|
|
|
|
|
|
2013-04-24 03:56:00 +02:00
|
|
|
|
Series.Delete(series.Id);
|
|
|
|
|
|
|
|
|
|
Series.All().Should().BeEmpty();
|
2013-04-22 05:18:08 +02:00
|
|
|
|
}
|
2013-05-04 04:42:11 +02:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void wrong_slug_should_return_404()
|
|
|
|
|
{
|
|
|
|
|
Series.Get("non-existing-slug", HttpStatusCode.NotFound);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-04 22:29:24 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void invalid_id_should_return_404()
|
|
|
|
|
{
|
|
|
|
|
Series.Get(99, HttpStatusCode.NotFound);
|
|
|
|
|
}
|
2013-04-19 06:46:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|