mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 14:55:20 -07:00
Fixed: Integration Unit Tests (#2500)
This commit is contained in:
parent
081d8a8e53
commit
b3e46d02c6
26 changed files with 423 additions and 564 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
|
@ -17,7 +17,6 @@ using NzbDrone.Core.Validation.Paths;
|
||||||
using NzbDrone.Core.DataAugmentation.Scene;
|
using NzbDrone.Core.DataAugmentation.Scene;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
using NzbDrone.Core.DecisionEngine;
|
using NzbDrone.Core.DecisionEngine;
|
||||||
using NzbDrone.Core.Tv;
|
|
||||||
using NzbDrone.SignalR;
|
using NzbDrone.SignalR;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Calendar
|
namespace NzbDrone.Api.Calendar
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
using NzbDrone.Core.MediaCover;
|
using NzbDrone.Core.MediaCover;
|
||||||
|
@ -15,7 +15,7 @@ namespace NzbDrone.Api.Movie
|
||||||
private readonly IProvideMovieInfo _movieInfo;
|
private readonly IProvideMovieInfo _movieInfo;
|
||||||
|
|
||||||
public MovieLookupModule(ISearchForNewMovie searchProxy, IProvideMovieInfo movieInfo)
|
public MovieLookupModule(ISearchForNewMovie searchProxy, IProvideMovieInfo movieInfo)
|
||||||
: base("/movies/lookup")
|
: base("/movie/lookup")
|
||||||
{
|
{
|
||||||
_movieInfo = movieInfo;
|
_movieInfo = movieInfo;
|
||||||
_searchProxy = searchProxy;
|
_searchProxy = searchProxy;
|
||||||
|
@ -64,4 +64,4 @@ namespace NzbDrone.Api.Movie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Api.Series;
|
using NzbDrone.Api.Movie;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BlacklistFixture : IntegrationTest
|
public class BlacklistFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
private SeriesResource _series;
|
private MovieResource _movie;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Adding to blacklist not supported")]
|
[Ignore("Adding to blacklist not supported")]
|
||||||
public void should_be_able_to_add_to_blacklist()
|
public void should_be_able_to_add_to_blacklist()
|
||||||
{
|
{
|
||||||
_series = EnsureSeries(266189, "The Blacklist");
|
_movie = EnsureMovie("tt0110912", "The Blacklist");
|
||||||
|
|
||||||
Blacklist.Post(new Api.Blacklist.BlacklistResource
|
Blacklist.Post(new Api.Blacklist.BlacklistResource
|
||||||
{
|
{
|
||||||
SeriesId = _series.Id,
|
MovieId = _movie.Id,
|
||||||
SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
SourceTitle = "Blacklist.S01E01.Brought.To.You.By-BoomBoxHD"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Api.Episodes;
|
using NzbDrone.Api.Movie;
|
||||||
using NzbDrone.Integration.Test.Client;
|
using NzbDrone.Integration.Test.Client;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -11,62 +11,62 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CalendarFixture : IntegrationTest
|
public class CalendarFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
public ClientBase<EpisodeResource> Calendar;
|
public ClientBase<MovieResource> Calendar;
|
||||||
|
|
||||||
protected override void InitRestClients()
|
protected override void InitRestClients()
|
||||||
{
|
{
|
||||||
base.InitRestClients();
|
base.InitRestClients();
|
||||||
|
|
||||||
Calendar = new ClientBase<EpisodeResource>(RestClient, ApiKey, "calendar");
|
Calendar = new ClientBase<MovieResource>(RestClient, ApiKey, "calendar");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_get_episodes()
|
public void should_be_able_to_get_movies()
|
||||||
{
|
{
|
||||||
var series = EnsureSeries(266189, "The Blacklist", true);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", true);
|
||||||
|
|
||||||
var request = Calendar.BuildRequest();
|
var request = Calendar.BuildRequest();
|
||||||
request.AddParameter("start", new DateTime(2015, 10, 1).ToString("s") + "Z");
|
request.AddParameter("start", new DateTime(1993, 10, 1).ToString("s") + "Z");
|
||||||
request.AddParameter("end", new DateTime(2015, 10, 3).ToString("s") + "Z");
|
request.AddParameter("end", new DateTime(1995, 10, 3).ToString("s") + "Z");
|
||||||
var items = Calendar.Get<List<EpisodeResource>>(request);
|
var items = Calendar.Get<List<MovieResource>>(request);
|
||||||
|
|
||||||
items = items.Where(v => v.SeriesId == series.Id).ToList();
|
items = items.Where(v => v.Id == movie.Id).ToList();
|
||||||
|
|
||||||
items.Should().HaveCount(1);
|
items.Should().HaveCount(1);
|
||||||
items.First().Title.Should().Be("The Troll Farmer");
|
items.First().Title.Should().Be("Pulp Fiction");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_be_able_to_get_unmonitored_episodes()
|
public void should_not_be_able_to_get_unmonitored_movies()
|
||||||
{
|
{
|
||||||
var series = EnsureSeries(266189, "The Blacklist", false);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
|
|
||||||
var request = Calendar.BuildRequest();
|
var request = Calendar.BuildRequest();
|
||||||
request.AddParameter("start", new DateTime(2015, 10, 1).ToString("s") + "Z");
|
request.AddParameter("start", new DateTime(1993, 10, 1).ToString("s") + "Z");
|
||||||
request.AddParameter("end", new DateTime(2015, 10, 3).ToString("s") + "Z");
|
request.AddParameter("end", new DateTime(1995, 10, 3).ToString("s") + "Z");
|
||||||
request.AddParameter("unmonitored", "false");
|
request.AddParameter("unmonitored", "false");
|
||||||
var items = Calendar.Get<List<EpisodeResource>>(request);
|
var items = Calendar.Get<List<MovieResource>>(request);
|
||||||
|
|
||||||
items = items.Where(v => v.SeriesId == series.Id).ToList();
|
items = items.Where(v => v.Id == movie.Id).ToList();
|
||||||
|
|
||||||
items.Should().BeEmpty();
|
items.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_be_able_to_get_unmonitored_episodes()
|
public void should_be_able_to_get_unmonitored_movies()
|
||||||
{
|
{
|
||||||
var series = EnsureSeries(266189, "The Blacklist", false);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
|
|
||||||
var request = Calendar.BuildRequest();
|
var request = Calendar.BuildRequest();
|
||||||
request.AddParameter("start", new DateTime(2015, 10, 1).ToString("s") + "Z");
|
request.AddParameter("start", new DateTime(1993, 10, 1).ToString("s") + "Z");
|
||||||
request.AddParameter("end", new DateTime(2015, 10, 3).ToString("s") + "Z");
|
request.AddParameter("end", new DateTime(1995, 10, 3).ToString("s") + "Z");
|
||||||
request.AddParameter("unmonitored", "true");
|
request.AddParameter("unmonitored", "true");
|
||||||
var items = Calendar.Get<List<EpisodeResource>>(request);
|
var items = Calendar.Get<List<MovieResource>>(request);
|
||||||
|
|
||||||
items = items.Where(v => v.SeriesId == series.Id).ToList();
|
items = items.Where(v => v.Id == movie.Id).ToList();
|
||||||
|
|
||||||
items.Should().HaveCount(1);
|
items.Should().HaveCount(1);
|
||||||
items.First().Title.Should().Be("The Troll Farmer");
|
items.First().Title.Should().Be("Pulp Fiction");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
using System.Threading;
|
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using NzbDrone.Api.Series;
|
|
||||||
using System.Linq;
|
|
||||||
using NzbDrone.Test.Common;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class EpisodeFixture : IntegrationTest
|
|
||||||
{
|
|
||||||
private SeriesResource series;
|
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
series = GivenSeriesWithEpisodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
private SeriesResource GivenSeriesWithEpisodes()
|
|
||||||
{
|
|
||||||
var newSeries = Series.Lookup("archer").Single(c => c.TvdbId == 110381);
|
|
||||||
|
|
||||||
newSeries.ProfileId = 1;
|
|
||||||
newSeries.Path = @"C:\Test\Archer".AsOsAgnostic();
|
|
||||||
|
|
||||||
newSeries = Series.Post(newSeries);
|
|
||||||
|
|
||||||
WaitForCompletion(() => Episodes.GetEpisodesInSeries(newSeries.Id).Count > 0);
|
|
||||||
|
|
||||||
return newSeries;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_be_able_to_get_all_episodes_in_series()
|
|
||||||
{
|
|
||||||
Episodes.GetEpisodesInSeries(series.Id).Count.Should().BeGreaterThan(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_be_able_to_get_a_single_episode()
|
|
||||||
{
|
|
||||||
var episodes = Episodes.GetEpisodesInSeries(series.Id);
|
|
||||||
|
|
||||||
Episodes.Get(episodes.First().Id).Should().NotBeNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_be_able_to_set_monitor_status()
|
|
||||||
{
|
|
||||||
var episodes = Episodes.GetEpisodesInSeries(series.Id);
|
|
||||||
var updatedEpisode = episodes.First();
|
|
||||||
updatedEpisode.Monitored = false;
|
|
||||||
|
|
||||||
Episodes.Put(updatedEpisode).Monitored.Should().BeFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[TearDown]
|
|
||||||
public void TearDown()
|
|
||||||
{
|
|
||||||
Series.Delete(series.Id);
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
@ -9,6 +9,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
public class IndexerFixture : IntegrationTest
|
public class IndexerFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
|
[Ignore("Need mock Newznab to test")]
|
||||||
public void should_have_built_in_indexer()
|
public void should_have_built_in_indexer()
|
||||||
{
|
{
|
||||||
var indexers = Indexers.All();
|
var indexers = Indexers.All();
|
||||||
|
@ -18,4 +19,4 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
indexers.Where(c => c.ConfigContract == typeof(NullConfig).Name).Should().OnlyContain(c => c.EnableRss);
|
indexers.Where(c => c.ConfigContract == typeof(NullConfig).Name).Should().OnlyContain(c => c.EnableRss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
42
src/NzbDrone.Integration.Test/ApiTests/MovieEditorFixture.cs
Normal file
42
src/NzbDrone.Integration.Test/ApiTests/MovieEditorFixture.cs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class MovieEditorFixture : IntegrationTest
|
||||||
|
{
|
||||||
|
private void GivenExistingMovie()
|
||||||
|
{
|
||||||
|
foreach (var title in new[] { "90210", "Dexter" })
|
||||||
|
{
|
||||||
|
var newMovie = Movies.Lookup(title).First();
|
||||||
|
|
||||||
|
newMovie.ProfileId = 1;
|
||||||
|
newMovie.Path = string.Format(@"C:\Test\{0}", title).AsOsAgnostic();
|
||||||
|
|
||||||
|
Movies.Post(newMovie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_be_able_to_update_multiple_movies()
|
||||||
|
{
|
||||||
|
GivenExistingMovie();
|
||||||
|
|
||||||
|
var movie = Movies.All();
|
||||||
|
|
||||||
|
foreach (var s in movie)
|
||||||
|
{
|
||||||
|
s.ProfileId = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Movies.Editor(movie);
|
||||||
|
|
||||||
|
result.Should().HaveCount(2);
|
||||||
|
result.TrueForAll(s => s.ProfileId == 2).Should().BeTrue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class EpisodeFileFixture : IntegrationTest
|
public class MovieFileFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void get_all_episodefiles()
|
public void get_all_moviefiles()
|
||||||
{
|
{
|
||||||
Assert.Ignore("TODO");
|
Assert.Ignore("TODO");
|
||||||
}
|
}
|
168
src/NzbDrone.Integration.Test/ApiTests/MovieFixture.cs
Normal file
168
src/NzbDrone.Integration.Test/ApiTests/MovieFixture.cs
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class MovieFixture : IntegrationTest
|
||||||
|
{
|
||||||
|
[Test, Order(0)]
|
||||||
|
public void add_movie_with_tags_should_store_them()
|
||||||
|
{
|
||||||
|
EnsureNoMovie("tt0110912", "Pulp Fiction");
|
||||||
|
var tag = EnsureTag("abc");
|
||||||
|
|
||||||
|
var movie = Movies.Lookup("imdb:tt0110912").Single();
|
||||||
|
|
||||||
|
movie.ProfileId = 1;
|
||||||
|
movie.Path = Path.Combine(MovieRootFolder, movie.Title);
|
||||||
|
movie.Tags = new HashSet<int>();
|
||||||
|
movie.Tags.Add(tag.Id);
|
||||||
|
|
||||||
|
var result = Movies.Post(movie);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result.Tags.Should().Equal(tag.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(0)]
|
||||||
|
public void add_movie_without_profileid_should_return_badrequest()
|
||||||
|
{
|
||||||
|
EnsureNoMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
|
var movie = Movies.Lookup("imdb:tt0110912").Single();
|
||||||
|
|
||||||
|
movie.Path = Path.Combine(MovieRootFolder, movie.Title);
|
||||||
|
|
||||||
|
Movies.InvalidPost(movie);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(0)]
|
||||||
|
public void add_movie_without_path_should_return_badrequest()
|
||||||
|
{
|
||||||
|
EnsureNoMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
|
var movie = Movies.Lookup("imdb:tt0110912").Single();
|
||||||
|
|
||||||
|
movie.ProfileId = 1;
|
||||||
|
|
||||||
|
Movies.InvalidPost(movie);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(1)]
|
||||||
|
public void add_movie()
|
||||||
|
{
|
||||||
|
EnsureNoMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
|
var movie = Movies.Lookup("imdb:tt0110912").Single();
|
||||||
|
|
||||||
|
movie.ProfileId = 1;
|
||||||
|
movie.Path = Path.Combine(MovieRootFolder, movie.Title);
|
||||||
|
|
||||||
|
var result = Movies.Post(movie);
|
||||||
|
|
||||||
|
result.Should().NotBeNull();
|
||||||
|
result.Id.Should().NotBe(0);
|
||||||
|
result.ProfileId.Should().Be(1);
|
||||||
|
result.Path.Should().Be(Path.Combine(MovieRootFolder, movie.Title));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test, Order(2)]
|
||||||
|
public void get_all_movies()
|
||||||
|
{
|
||||||
|
EnsureMovie("tt0110912", "Pulp Fiction");
|
||||||
|
EnsureMovie("tt0468569", "The Dark Knight");
|
||||||
|
|
||||||
|
Movies.All().Should().NotBeNullOrEmpty();
|
||||||
|
Movies.All().Should().Contain(v => v.ImdbId == "tt0110912");
|
||||||
|
Movies.All().Should().Contain(v => v.ImdbId == "tt0468569");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(2)]
|
||||||
|
public void get_movie_by_id()
|
||||||
|
{
|
||||||
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
|
var result = Movies.Get(movie.Id);
|
||||||
|
|
||||||
|
result.ImdbId.Should().Be("tt0110912");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void get_movie_by_unknown_id_should_return_404()
|
||||||
|
{
|
||||||
|
var result = Movies.InvalidGet(1000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(2)]
|
||||||
|
public void update_movie_profile_id()
|
||||||
|
{
|
||||||
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
|
var profileId = 1;
|
||||||
|
if (movie.ProfileId == profileId)
|
||||||
|
{
|
||||||
|
profileId = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
movie.ProfileId = profileId;
|
||||||
|
|
||||||
|
var result = Movies.Put(movie);
|
||||||
|
|
||||||
|
Movies.Get(movie.Id).ProfileId.Should().Be(profileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(3)]
|
||||||
|
public void update_movie_monitored()
|
||||||
|
{
|
||||||
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
|
|
||||||
|
movie.Monitored.Should().BeFalse();
|
||||||
|
|
||||||
|
movie.Monitored = true;
|
||||||
|
|
||||||
|
var result = Movies.Put(movie);
|
||||||
|
|
||||||
|
result.Monitored.Should().BeTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(3)]
|
||||||
|
public void update_movie_tags()
|
||||||
|
{
|
||||||
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction");
|
||||||
|
var tag = EnsureTag("abc");
|
||||||
|
|
||||||
|
if (movie.Tags.Contains(tag.Id))
|
||||||
|
{
|
||||||
|
movie.Tags.Remove(tag.Id);
|
||||||
|
|
||||||
|
var result = Movies.Put(movie);
|
||||||
|
Movies.Get(movie.Id).Tags.Should().NotContain(tag.Id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
movie.Tags.Add(tag.Id);
|
||||||
|
|
||||||
|
var result = Movies.Put(movie);
|
||||||
|
Movies.Get(movie.Id).Tags.Should().Contain(tag.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, Order(4)]
|
||||||
|
public void delete_movie()
|
||||||
|
{
|
||||||
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
|
Movies.Get(movie.Id).Should().NotBeNull();
|
||||||
|
|
||||||
|
Movies.Delete(movie.Id);
|
||||||
|
|
||||||
|
Movies.All().Should().NotContain(v => v.ImdbId == "tt0110912");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
src/NzbDrone.Integration.Test/ApiTests/MovieLookupFixture.cs
Normal file
37
src/NzbDrone.Integration.Test/ApiTests/MovieLookupFixture.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class MovieLookupFixture : IntegrationTest
|
||||||
|
{
|
||||||
|
[TestCase("psycho", "Psycho")]
|
||||||
|
[TestCase("pulp fiction", "Pulp Fiction")]
|
||||||
|
public void lookup_new_movie_by_title(string term, string title)
|
||||||
|
{
|
||||||
|
var movie = Movies.Lookup(term);
|
||||||
|
|
||||||
|
movie.Should().NotBeEmpty();
|
||||||
|
movie.Should().Contain(c => c.Title == title);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void lookup_new_movie_by_imdbid()
|
||||||
|
{
|
||||||
|
var movie = Movies.Lookup("imdb:tt0110912");
|
||||||
|
|
||||||
|
movie.Should().NotBeEmpty();
|
||||||
|
movie.Should().Contain(c => c.Title == "Pulp Fiction");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Unreliable")]
|
||||||
|
public void lookup_random_movie_using_asterix()
|
||||||
|
{
|
||||||
|
var movie = Movies.Lookup("*");
|
||||||
|
|
||||||
|
movie.Should().NotBeEmpty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
|
@ -26,15 +26,12 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
var config = NamingConfig.GetSingle();
|
var config = NamingConfig.GetSingle();
|
||||||
config.RenameEpisodes = false;
|
config.RenameEpisodes = false;
|
||||||
config.StandardEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
config.StandardMovieFormat = "{Movie Title}";
|
||||||
config.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
|
||||||
config.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
|
||||||
|
|
||||||
var result = NamingConfig.Put(config);
|
var result = NamingConfig.Put(config);
|
||||||
result.RenameEpisodes.Should().BeFalse();
|
result.RenameEpisodes.Should().BeFalse();
|
||||||
result.StandardEpisodeFormat.Should().Be(config.StandardEpisodeFormat);
|
result.StandardMovieFormat.Should().Be(config.StandardMovieFormat);
|
||||||
result.DailyEpisodeFormat.Should().Be(config.DailyEpisodeFormat);
|
|
||||||
result.AnimeEpisodeFormat.Should().Be(config.AnimeEpisodeFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -42,48 +39,18 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
var config = NamingConfig.GetSingle();
|
var config = NamingConfig.GetSingle();
|
||||||
config.RenameEpisodes = true;
|
config.RenameEpisodes = true;
|
||||||
config.StandardEpisodeFormat = "";
|
config.StandardMovieFormat = "";
|
||||||
config.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
|
||||||
config.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
errors.Should().NotBeNull();
|
errors.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_get_bad_request_if_standard_format_doesnt_contain_season_and_episode()
|
public void should_get_bad_request_if_standard_format_doesnt_contain_title()
|
||||||
{
|
{
|
||||||
var config = NamingConfig.GetSingle();
|
var config = NamingConfig.GetSingle();
|
||||||
config.RenameEpisodes = true;
|
config.RenameEpisodes = true;
|
||||||
config.StandardEpisodeFormat = "{season}";
|
config.StandardMovieFormat = "{quality}";
|
||||||
config.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
|
||||||
config.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
|
||||||
errors.Should().NotBeNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_get_bad_request_if_daily_format_doesnt_contain_season_and_episode_or_air_date()
|
|
||||||
{
|
|
||||||
var config = NamingConfig.GetSingle();
|
|
||||||
config.RenameEpisodes = true;
|
|
||||||
config.StandardEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
|
||||||
config.DailyEpisodeFormat = "{Series Title} - {season} - {Episode Title}";
|
|
||||||
config.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
|
||||||
errors.Should().NotBeNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_get_bad_request_if_anime_format_doesnt_contain_season_and_episode_or_absolute()
|
|
||||||
{
|
|
||||||
var config = NamingConfig.GetSingle();
|
|
||||||
config.RenameEpisodes = false;
|
|
||||||
config.StandardEpisodeFormat = "{Series Title} - {season}x{episode:00} - {Episode Title}";
|
|
||||||
config.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
|
||||||
config.AnimeEpisodeFormat = "{Series Title} - {season} - {Episode Title}";
|
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
errors.Should().NotBeNull();
|
errors.Should().NotBeNull();
|
||||||
|
@ -94,8 +61,7 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
var config = NamingConfig.GetSingle();
|
var config = NamingConfig.GetSingle();
|
||||||
config.RenameEpisodes = false;
|
config.RenameEpisodes = false;
|
||||||
config.StandardEpisodeFormat = "";
|
config.StandardMovieFormat = "";
|
||||||
config.DailyEpisodeFormat = "";
|
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
errors.Should().NotBeNull();
|
errors.Should().NotBeNull();
|
||||||
|
@ -106,22 +72,21 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
var config = NamingConfig.GetSingle();
|
var config = NamingConfig.GetSingle();
|
||||||
config.RenameEpisodes = true;
|
config.RenameEpisodes = true;
|
||||||
config.StandardEpisodeFormat = "";
|
config.StandardMovieFormat = "";
|
||||||
config.DailyEpisodeFormat = "";
|
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
errors.Should().NotBeNull();
|
errors.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_get_bad_request_if_series_folder_format_does_not_contain_series_title()
|
public void should_get_bad_request_if_movie_folder_format_does_not_contain_movie_title()
|
||||||
{
|
{
|
||||||
var config = NamingConfig.GetSingle();
|
var config = NamingConfig.GetSingle();
|
||||||
config.RenameEpisodes = true;
|
config.RenameEpisodes = true;
|
||||||
config.SeriesFolderFormat = "This and That";
|
config.MovieFolderFormat = "This and That";
|
||||||
|
|
||||||
var errors = NamingConfig.InvalidPut(config);
|
var errors = NamingConfig.InvalidPut(config);
|
||||||
errors.Should().NotBeNull();
|
errors.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Api.Indexers;
|
using NzbDrone.Api.Indexers;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -7,15 +7,16 @@ using System.Net;
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
[Ignore("Need mock Newznab to test")]
|
||||||
public class ReleaseFixture : IntegrationTest
|
public class ReleaseFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void should_only_have_unknown_series_releases()
|
public void should_only_have_unknown_movie_releases()
|
||||||
{
|
{
|
||||||
var releases = Releases.All();
|
var releases = Releases.All();
|
||||||
var indexers = Indexers.All();
|
var indexers = Indexers.All();
|
||||||
|
|
||||||
releases.Should().OnlyContain(c => c.Rejections.Contains("Unknown Series"));
|
releases.Should().OnlyContain(c => c.Rejections.Contains("Unknown Movie"));
|
||||||
releases.Should().OnlyContain(c => BeValidRelease(c));
|
releases.Should().OnlyContain(c => BeValidRelease(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,4 +56,4 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using System.Linq;
|
|
||||||
using NzbDrone.Test.Common;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class SeriesEditorFixture : IntegrationTest
|
|
||||||
{
|
|
||||||
private void GivenExistingSeries()
|
|
||||||
{
|
|
||||||
foreach (var title in new[] { "90210", "Dexter" })
|
|
||||||
{
|
|
||||||
var newSeries = Series.Lookup(title).First();
|
|
||||||
|
|
||||||
newSeries.ProfileId = 1;
|
|
||||||
newSeries.Path = string.Format(@"C:\Test\{0}", title).AsOsAgnostic();
|
|
||||||
|
|
||||||
Series.Post(newSeries);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_be_able_to_update_multiple_series()
|
|
||||||
{
|
|
||||||
GivenExistingSeries();
|
|
||||||
|
|
||||||
var series = Series.All();
|
|
||||||
|
|
||||||
foreach (var s in series)
|
|
||||||
{
|
|
||||||
s.ProfileId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = Series.Editor(series);
|
|
||||||
|
|
||||||
result.Should().HaveCount(2);
|
|
||||||
result.TrueForAll(s => s.ProfileId == 2).Should().BeTrue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,173 +0,0 @@
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using System.Linq;
|
|
||||||
using System.IO;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class SeriesFixture : IntegrationTest
|
|
||||||
{
|
|
||||||
[Test, Order(0)]
|
|
||||||
public void add_series_with_tags_should_store_them()
|
|
||||||
{
|
|
||||||
EnsureNoSeries(266189, "The Blacklist");
|
|
||||||
var tag = EnsureTag("abc");
|
|
||||||
|
|
||||||
var series = Series.Lookup("tvdb:266189").Single();
|
|
||||||
|
|
||||||
series.ProfileId = 1;
|
|
||||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
|
||||||
series.Tags = new HashSet<int>();
|
|
||||||
series.Tags.Add(tag.Id);
|
|
||||||
|
|
||||||
var result = Series.Post(series);
|
|
||||||
|
|
||||||
result.Should().NotBeNull();
|
|
||||||
result.Tags.Should().Equal(tag.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(0)]
|
|
||||||
public void add_series_without_profileid_should_return_badrequest()
|
|
||||||
{
|
|
||||||
EnsureNoSeries(266189, "The Blacklist");
|
|
||||||
|
|
||||||
var series = Series.Lookup("tvdb:266189").Single();
|
|
||||||
|
|
||||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
|
||||||
|
|
||||||
Series.InvalidPost(series);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(0)]
|
|
||||||
public void add_series_without_path_should_return_badrequest()
|
|
||||||
{
|
|
||||||
EnsureNoSeries(266189, "The Blacklist");
|
|
||||||
|
|
||||||
var series = Series.Lookup("tvdb:266189").Single();
|
|
||||||
|
|
||||||
series.ProfileId = 1;
|
|
||||||
|
|
||||||
Series.InvalidPost(series);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(1)]
|
|
||||||
public void add_series()
|
|
||||||
{
|
|
||||||
EnsureNoSeries(266189, "The Blacklist");
|
|
||||||
|
|
||||||
var series = Series.Lookup("tvdb:266189").Single();
|
|
||||||
|
|
||||||
series.ProfileId = 1;
|
|
||||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
|
||||||
|
|
||||||
var result = Series.Post(series);
|
|
||||||
|
|
||||||
result.Should().NotBeNull();
|
|
||||||
result.Id.Should().NotBe(0);
|
|
||||||
result.ProfileId.Should().Be(1);
|
|
||||||
result.Path.Should().Be(Path.Combine(SeriesRootFolder, series.Title));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test, Order(2)]
|
|
||||||
public void get_all_series()
|
|
||||||
{
|
|
||||||
EnsureSeries(266189, "The Blacklist");
|
|
||||||
EnsureSeries(73065, "Archer");
|
|
||||||
|
|
||||||
Series.All().Should().NotBeNullOrEmpty();
|
|
||||||
Series.All().Should().Contain(v => v.TvdbId == 73065);
|
|
||||||
Series.All().Should().Contain(v => v.TvdbId == 266189);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(2)]
|
|
||||||
public void get_series_by_id()
|
|
||||||
{
|
|
||||||
var series = EnsureSeries(266189, "The Blacklist");
|
|
||||||
|
|
||||||
var result = Series.Get(series.Id);
|
|
||||||
|
|
||||||
result.TvdbId.Should().Be(266189);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void get_series_by_unknown_id_should_return_404()
|
|
||||||
{
|
|
||||||
var result = Series.InvalidGet(1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(2)]
|
|
||||||
public void update_series_profile_id()
|
|
||||||
{
|
|
||||||
var series = EnsureSeries(266189, "The Blacklist");
|
|
||||||
|
|
||||||
var profileId = 1;
|
|
||||||
if (series.ProfileId == profileId)
|
|
||||||
{
|
|
||||||
profileId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
series.ProfileId = profileId;
|
|
||||||
|
|
||||||
var result = Series.Put(series);
|
|
||||||
|
|
||||||
Series.Get(series.Id).ProfileId.Should().Be(profileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(3)]
|
|
||||||
public void update_series_monitored()
|
|
||||||
{
|
|
||||||
var series = EnsureSeries(266189, "The Blacklist", false);
|
|
||||||
|
|
||||||
series.Monitored.Should().BeFalse();
|
|
||||||
series.Seasons.First().Monitored.Should().BeFalse();
|
|
||||||
|
|
||||||
series.Monitored = true;
|
|
||||||
series.Seasons.ForEach(season =>
|
|
||||||
{
|
|
||||||
season.Monitored = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
var result = Series.Put(series);
|
|
||||||
|
|
||||||
result.Monitored.Should().BeTrue();
|
|
||||||
result.Seasons.First().Monitored.Should().BeTrue();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(3)]
|
|
||||||
public void update_series_tags()
|
|
||||||
{
|
|
||||||
var series = EnsureSeries(266189, "The Blacklist");
|
|
||||||
var tag = EnsureTag("abc");
|
|
||||||
|
|
||||||
if (series.Tags.Contains(tag.Id))
|
|
||||||
{
|
|
||||||
series.Tags.Remove(tag.Id);
|
|
||||||
|
|
||||||
var result = Series.Put(series);
|
|
||||||
Series.Get(series.Id).Tags.Should().NotContain(tag.Id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
series.Tags.Add(tag.Id);
|
|
||||||
|
|
||||||
var result = Series.Put(series);
|
|
||||||
Series.Get(series.Id).Tags.Should().Contain(tag.Id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, Order(4)]
|
|
||||||
public void delete_series()
|
|
||||||
{
|
|
||||||
var series = EnsureSeries(266189, "The Blacklist");
|
|
||||||
|
|
||||||
Series.Get(series.Id).Should().NotBeNull();
|
|
||||||
|
|
||||||
Series.Delete(series.Id);
|
|
||||||
|
|
||||||
Series.All().Should().NotContain(v => v.TvdbId == 266189);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
using FluentAssertions;
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class SeriesLookupFixture : IntegrationTest
|
|
||||||
{
|
|
||||||
[TestCase("archer", "Archer (2009)")]
|
|
||||||
[TestCase("90210", "90210")]
|
|
||||||
public void lookup_new_series_by_title(string term, string title)
|
|
||||||
{
|
|
||||||
var series = Series.Lookup(term);
|
|
||||||
|
|
||||||
series.Should().NotBeEmpty();
|
|
||||||
series.Should().Contain(c => c.Title == title);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void lookup_new_series_by_tvdbid()
|
|
||||||
{
|
|
||||||
var series = Series.Lookup("tvdb:266189");
|
|
||||||
|
|
||||||
series.Should().NotBeEmpty();
|
|
||||||
series.Should().Contain(c => c.Title == "The Blacklist");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore("Unreliable")]
|
|
||||||
public void lookup_random_series_using_asterix()
|
|
||||||
{
|
|
||||||
var series = Series.Lookup("*");
|
|
||||||
|
|
||||||
series.Should().NotBeEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,9 +11,9 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
[Test, Order(0)]
|
[Test, Order(0)]
|
||||||
public void missing_should_be_empty()
|
public void missing_should_be_empty()
|
||||||
{
|
{
|
||||||
EnsureNoSeries(266189, "The Blacklist");
|
EnsureNoMovie("tt0110912", "Pulp Fiction");
|
||||||
|
|
||||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.Should().BeEmpty();
|
result.Records.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
@ -21,32 +21,31 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
[Test, Order(1)]
|
[Test, Order(1)]
|
||||||
public void missing_should_have_monitored_items()
|
public void missing_should_have_monitored_items()
|
||||||
{
|
{
|
||||||
EnsureSeries(266189, "The Blacklist", true);
|
EnsureMovie("tt0110912", "Pulp Fiction", true);
|
||||||
|
|
||||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.Should().NotBeEmpty();
|
result.Records.Should().NotBeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(1)]
|
[Test, Order(1)]
|
||||||
public void missing_should_have_series()
|
public void missing_should_have_movie()
|
||||||
{
|
{
|
||||||
EnsureSeries(266189, "The Blacklist", true);
|
EnsureMovie("tt0110912", "Pulp Fiction", true);
|
||||||
|
|
||||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.First().Series.Should().NotBeNull();
|
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||||
result.Records.First().Series.Title.Should().Be("The Blacklist");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(1)]
|
[Test, Order(1)]
|
||||||
public void cutoff_should_have_monitored_items()
|
public void cutoff_should_have_monitored_items()
|
||||||
{
|
{
|
||||||
EnsureProfileCutoff(1, Quality.HDTV720p);
|
EnsureProfileCutoff(1, Quality.HDTV720p);
|
||||||
var series = EnsureSeries(266189, "The Blacklist", true);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", true);
|
||||||
EnsureEpisodeFile(series, 1, 1, Quality.SDTV);
|
EnsureMovieFile(movie, Quality.SDTV);
|
||||||
|
|
||||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.Should().NotBeEmpty();
|
result.Records.Should().NotBeEmpty();
|
||||||
}
|
}
|
||||||
|
@ -54,9 +53,9 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
[Test, Order(1)]
|
[Test, Order(1)]
|
||||||
public void missing_should_not_have_unmonitored_items()
|
public void missing_should_not_have_unmonitored_items()
|
||||||
{
|
{
|
||||||
EnsureSeries(266189, "The Blacklist", false);
|
EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
|
|
||||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.Should().BeEmpty();
|
result.Records.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
@ -65,33 +64,32 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
public void cutoff_should_not_have_unmonitored_items()
|
public void cutoff_should_not_have_unmonitored_items()
|
||||||
{
|
{
|
||||||
EnsureProfileCutoff(1, Quality.HDTV720p);
|
EnsureProfileCutoff(1, Quality.HDTV720p);
|
||||||
var series = EnsureSeries(266189, "The Blacklist", false);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
EnsureEpisodeFile(series, 1, 1, Quality.SDTV);
|
EnsureMovieFile(movie, Quality.SDTV);
|
||||||
|
|
||||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.Should().BeEmpty();
|
result.Records.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(1)]
|
[Test, Order(1)]
|
||||||
public void cutoff_should_have_series()
|
public void cutoff_should_have_movie()
|
||||||
{
|
{
|
||||||
EnsureProfileCutoff(1, Quality.HDTV720p);
|
EnsureProfileCutoff(1, Quality.HDTV720p);
|
||||||
var series = EnsureSeries(266189, "The Blacklist", true);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", true);
|
||||||
EnsureEpisodeFile(series, 1, 1, Quality.SDTV);
|
EnsureMovieFile(movie, Quality.SDTV);
|
||||||
|
|
||||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc");
|
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc");
|
||||||
|
|
||||||
result.Records.First().Series.Should().NotBeNull();
|
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||||
result.Records.First().Series.Title.Should().Be("The Blacklist");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Order(2)]
|
[Test, Order(2)]
|
||||||
public void missing_should_have_unmonitored_items()
|
public void missing_should_have_unmonitored_items()
|
||||||
{
|
{
|
||||||
EnsureSeries(266189, "The Blacklist", false);
|
EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
|
|
||||||
var result = WantedMissing.GetPaged(0, 15, "airDateUtc", "desc", "monitored", "false");
|
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "false");
|
||||||
|
|
||||||
result.Records.Should().NotBeEmpty();
|
result.Records.Should().NotBeEmpty();
|
||||||
}
|
}
|
||||||
|
@ -100,10 +98,10 @@ namespace NzbDrone.Integration.Test.ApiTests
|
||||||
public void cutoff_should_have_unmonitored_items()
|
public void cutoff_should_have_unmonitored_items()
|
||||||
{
|
{
|
||||||
EnsureProfileCutoff(1, Quality.HDTV720p);
|
EnsureProfileCutoff(1, Quality.HDTV720p);
|
||||||
var series = EnsureSeries(266189, "The Blacklist", false);
|
var movie = EnsureMovie("tt0110912", "Pulp Fiction", false);
|
||||||
EnsureEpisodeFile(series, 1, 1, Quality.SDTV);
|
EnsureMovieFile(movie, Quality.SDTV);
|
||||||
|
|
||||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "airDateUtc", "desc", "monitored", "false");
|
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "false");
|
||||||
|
|
||||||
result.Records.Should().NotBeEmpty();
|
result.Records.Should().NotBeEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using NzbDrone.Api.Episodes;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.Client
|
|
||||||
{
|
|
||||||
public class EpisodeClient : ClientBase<EpisodeResource>
|
|
||||||
{
|
|
||||||
public EpisodeClient(IRestClient restClient, string apiKey)
|
|
||||||
: base(restClient, apiKey, "episode")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<EpisodeResource> GetEpisodesInSeries(int seriesId)
|
|
||||||
{
|
|
||||||
var request = BuildRequest("?seriesId=" + seriesId.ToString());
|
|
||||||
return Get<List<EpisodeResource>>(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
44
src/NzbDrone.Integration.Test/Client/MovieClient.cs
Normal file
44
src/NzbDrone.Integration.Test/Client/MovieClient.cs
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using NzbDrone.Api.Movie;
|
||||||
|
using RestSharp;
|
||||||
|
|
||||||
|
namespace NzbDrone.Integration.Test.Client
|
||||||
|
{
|
||||||
|
public class MovieClient : ClientBase<MovieResource>
|
||||||
|
{
|
||||||
|
public MovieClient(IRestClient restClient, string apiKey)
|
||||||
|
: base(restClient, apiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MovieResource> Lookup(string term)
|
||||||
|
{
|
||||||
|
var request = BuildRequest("lookup?term={term}");
|
||||||
|
request.AddUrlSegment("term", term);
|
||||||
|
return Get<List<MovieResource>>(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MovieResource> Editor(List<MovieResource> movie)
|
||||||
|
{
|
||||||
|
var request = BuildRequest("editor");
|
||||||
|
request.AddBody(movie);
|
||||||
|
return Put<List<MovieResource>>(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieResource Get(string slug, HttpStatusCode statusCode = HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
var request = BuildRequest(slug);
|
||||||
|
return Get<MovieResource>(request, statusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SystemInfoClient : ClientBase<MovieResource>
|
||||||
|
{
|
||||||
|
public SystemInfoClient(IRestClient restClient, string apiKey)
|
||||||
|
: base(restClient, apiKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,44 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net;
|
|
||||||
using NzbDrone.Api.Series;
|
|
||||||
using RestSharp;
|
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.Client
|
|
||||||
{
|
|
||||||
public class SeriesClient : ClientBase<SeriesResource>
|
|
||||||
{
|
|
||||||
public SeriesClient(IRestClient restClient, string apiKey)
|
|
||||||
: base(restClient, apiKey)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SeriesResource> Lookup(string term)
|
|
||||||
{
|
|
||||||
var request = BuildRequest("lookup?term={term}");
|
|
||||||
request.AddUrlSegment("term", term);
|
|
||||||
return Get<List<SeriesResource>>(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SeriesResource> Editor(List<SeriesResource> series)
|
|
||||||
{
|
|
||||||
var request = BuildRequest("editor");
|
|
||||||
request.AddBody(series);
|
|
||||||
return Put<List<SeriesResource>>(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SeriesResource Get(string slug, HttpStatusCode statusCode = HttpStatusCode.OK)
|
|
||||||
{
|
|
||||||
var request = BuildRequest(slug);
|
|
||||||
return Get<SeriesResource>(request, statusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SystemInfoClient : ClientBase<SeriesResource>
|
|
||||||
{
|
|
||||||
public SystemInfoClient(IRestClient restClient, string apiKey)
|
|
||||||
: base(restClient, apiKey)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Api.Extensions;
|
using NzbDrone.Api.Extensions;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
|
@ -8,7 +8,7 @@ namespace NzbDrone.Integration.Test
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class CorsFixture : IntegrationTest
|
public class CorsFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
private RestRequest BuildGet(string route = "series")
|
private RestRequest BuildGet(string route = "movie")
|
||||||
{
|
{
|
||||||
var request = new RestRequest(route, Method.GET);
|
var request = new RestRequest(route, Method.GET);
|
||||||
request.AddHeader(AccessControlHeaders.RequestMethod, "POST");
|
request.AddHeader(AccessControlHeaders.RequestMethod, "POST");
|
||||||
|
@ -16,7 +16,7 @@ namespace NzbDrone.Integration.Test
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestRequest BuildOptions(string route = "series")
|
private RestRequest BuildOptions(string route = "movie")
|
||||||
{
|
{
|
||||||
var request = new RestRequest(route, Method.OPTIONS);
|
var request = new RestRequest(route, Method.OPTIONS);
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Api.Movie;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test
|
namespace NzbDrone.Integration.Test
|
||||||
{
|
{
|
||||||
|
@ -18,7 +19,7 @@ namespace NzbDrone.Integration.Test
|
||||||
var logFile = Path.Combine(_runner.AppData, "logs", "radarr.trace.txt");
|
var logFile = Path.Combine(_runner.AppData, "logs", "radarr.trace.txt");
|
||||||
var logLines = File.ReadAllLines(logFile);
|
var logLines = File.ReadAllLines(logFile);
|
||||||
|
|
||||||
var result = Series.InvalidPost(new Api.Series.SeriesResource());
|
var result = Movies.InvalidPost(new MovieResource());
|
||||||
|
|
||||||
logLines = File.ReadAllLines(logFile).Skip(logLines.Length).ToArray();
|
logLines = File.ReadAllLines(logFile).Skip(logLines.Length).ToArray();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Core.Indexers.Newznab;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test
|
namespace NzbDrone.Integration.Test
|
||||||
|
@ -8,7 +9,7 @@ namespace NzbDrone.Integration.Test
|
||||||
{
|
{
|
||||||
protected NzbDroneRunner _runner;
|
protected NzbDroneRunner _runner;
|
||||||
|
|
||||||
public override string SeriesRootFolder => GetTempDirectory("SeriesRootFolder");
|
public override string MovieRootFolder => GetTempDirectory("MovieRootFolder");
|
||||||
|
|
||||||
protected override string RootUrl => "http://localhost:7878/";
|
protected override string RootUrl => "http://localhost:7878/";
|
||||||
|
|
||||||
|
@ -24,15 +25,15 @@ namespace NzbDrone.Integration.Test
|
||||||
|
|
||||||
protected override void InitializeTestTarget()
|
protected override void InitializeTestTarget()
|
||||||
{
|
{
|
||||||
// Add Wombles
|
Indexers.Post(new Api.Indexers.IndexerResource
|
||||||
var wombles = Indexers.Post(new Api.Indexers.IndexerResource
|
|
||||||
{
|
{
|
||||||
EnableRss = true,
|
EnableRss = false,
|
||||||
ConfigContract = "NullConfig",
|
EnableSearch = false,
|
||||||
Implementation = "Wombles",
|
ConfigContract = nameof(NewznabSettings),
|
||||||
Name = "Wombles",
|
Implementation = nameof(Newznab),
|
||||||
|
Name = "NewznabTest",
|
||||||
Protocol = Core.Indexers.DownloadProtocol.Usenet,
|
Protocol = Core.Indexers.DownloadProtocol.Usenet,
|
||||||
Fields = new List<Api.ClientSchema.Field>()
|
Fields = Api.ClientSchema.SchemaBuilder.ToSchema(new NewznabSettings())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,15 @@ using NzbDrone.Api.Blacklist;
|
||||||
using NzbDrone.Api.Commands;
|
using NzbDrone.Api.Commands;
|
||||||
using NzbDrone.Api.Config;
|
using NzbDrone.Api.Config;
|
||||||
using NzbDrone.Api.DownloadClient;
|
using NzbDrone.Api.DownloadClient;
|
||||||
using NzbDrone.Api.EpisodeFiles;
|
|
||||||
using NzbDrone.Api.Episodes;
|
using NzbDrone.Api.Episodes;
|
||||||
using NzbDrone.Api.History;
|
using NzbDrone.Api.History;
|
||||||
using NzbDrone.Api.Profiles;
|
using NzbDrone.Api.Profiles;
|
||||||
using NzbDrone.Api.RootFolders;
|
using NzbDrone.Api.RootFolders;
|
||||||
using NzbDrone.Api.Series;
|
using NzbDrone.Api.Movie;
|
||||||
using NzbDrone.Api.Tags;
|
using NzbDrone.Api.Tags;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
|
using NzbDrone.Core.MediaFiles.Events;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Tv.Commands;
|
using NzbDrone.Core.Tv.Commands;
|
||||||
using NzbDrone.Integration.Test.Client;
|
using NzbDrone.Integration.Test.Client;
|
||||||
|
@ -40,7 +40,6 @@ namespace NzbDrone.Integration.Test
|
||||||
public ClientBase<BlacklistResource> Blacklist;
|
public ClientBase<BlacklistResource> Blacklist;
|
||||||
public CommandClient Commands;
|
public CommandClient Commands;
|
||||||
public DownloadClientClient DownloadClients;
|
public DownloadClientClient DownloadClients;
|
||||||
public EpisodeClient Episodes;
|
|
||||||
public ClientBase<HistoryResource> History;
|
public ClientBase<HistoryResource> History;
|
||||||
public ClientBase<HostConfigResource> HostConfig;
|
public ClientBase<HostConfigResource> HostConfig;
|
||||||
public IndexerClient Indexers;
|
public IndexerClient Indexers;
|
||||||
|
@ -49,7 +48,7 @@ namespace NzbDrone.Integration.Test
|
||||||
public ClientBase<ProfileResource> Profiles;
|
public ClientBase<ProfileResource> Profiles;
|
||||||
public ReleaseClient Releases;
|
public ReleaseClient Releases;
|
||||||
public ClientBase<RootFolderResource> RootFolders;
|
public ClientBase<RootFolderResource> RootFolders;
|
||||||
public SeriesClient Series;
|
public MovieClient Movies;
|
||||||
public ClientBase<TagResource> Tags;
|
public ClientBase<TagResource> Tags;
|
||||||
public ClientBase<EpisodeResource> WantedMissing;
|
public ClientBase<EpisodeResource> WantedMissing;
|
||||||
public ClientBase<EpisodeResource> WantedCutoffUnmet;
|
public ClientBase<EpisodeResource> WantedCutoffUnmet;
|
||||||
|
@ -71,7 +70,7 @@ namespace NzbDrone.Integration.Test
|
||||||
|
|
||||||
public string TempDirectory { get; private set; }
|
public string TempDirectory { get; private set; }
|
||||||
|
|
||||||
public abstract string SeriesRootFolder { get; }
|
public abstract string MovieRootFolder { get; }
|
||||||
|
|
||||||
protected abstract string RootUrl { get; }
|
protected abstract string RootUrl { get; }
|
||||||
|
|
||||||
|
@ -100,7 +99,6 @@ namespace NzbDrone.Integration.Test
|
||||||
Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
|
Blacklist = new ClientBase<BlacklistResource>(RestClient, ApiKey);
|
||||||
Commands = new CommandClient(RestClient, ApiKey);
|
Commands = new CommandClient(RestClient, ApiKey);
|
||||||
DownloadClients = new DownloadClientClient(RestClient, ApiKey);
|
DownloadClients = new DownloadClientClient(RestClient, ApiKey);
|
||||||
Episodes = new EpisodeClient(RestClient, ApiKey);
|
|
||||||
History = new ClientBase<HistoryResource>(RestClient, ApiKey);
|
History = new ClientBase<HistoryResource>(RestClient, ApiKey);
|
||||||
HostConfig = new ClientBase<HostConfigResource>(RestClient, ApiKey, "config/host");
|
HostConfig = new ClientBase<HostConfigResource>(RestClient, ApiKey, "config/host");
|
||||||
Indexers = new IndexerClient(RestClient, ApiKey);
|
Indexers = new IndexerClient(RestClient, ApiKey);
|
||||||
|
@ -109,7 +107,7 @@ namespace NzbDrone.Integration.Test
|
||||||
Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
|
Profiles = new ClientBase<ProfileResource>(RestClient, ApiKey);
|
||||||
Releases = new ReleaseClient(RestClient, ApiKey);
|
Releases = new ReleaseClient(RestClient, ApiKey);
|
||||||
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
|
RootFolders = new ClientBase<RootFolderResource>(RestClient, ApiKey);
|
||||||
Series = new SeriesClient(RestClient, ApiKey);
|
Movies = new MovieClient(RestClient, ApiKey);
|
||||||
Tags = new ClientBase<TagResource>(RestClient, ApiKey);
|
Tags = new ClientBase<TagResource>(RestClient, ApiKey);
|
||||||
WantedMissing = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/missing");
|
WantedMissing = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/missing");
|
||||||
WantedCutoffUnmet = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/cutoff");
|
WantedCutoffUnmet = new ClientBase<EpisodeResource>(RestClient, ApiKey, "wanted/cutoff");
|
||||||
|
@ -202,24 +200,22 @@ namespace NzbDrone.Integration.Test
|
||||||
Assert.Fail("Timed on wait");
|
Assert.Fail("Timed on wait");
|
||||||
}
|
}
|
||||||
|
|
||||||
public SeriesResource EnsureSeries(int tvdbId, string seriesTitle, bool? monitored = null)
|
public MovieResource EnsureMovie(string imdbId, string movieTitle, bool? monitored = null)
|
||||||
{
|
{
|
||||||
var result = Series.All().FirstOrDefault(v => v.TvdbId == tvdbId);
|
var result = Movies.All().FirstOrDefault(v => v.ImdbId == imdbId);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
var lookup = Series.Lookup("tvdb:" + tvdbId);
|
var lookup = Movies.Lookup("imdb:" + imdbId);
|
||||||
var series = lookup.First();
|
var movie = lookup.First();
|
||||||
series.ProfileId = 1;
|
movie.ProfileId = 1;
|
||||||
series.Path = Path.Combine(SeriesRootFolder, series.Title);
|
movie.Path = Path.Combine(MovieRootFolder, movie.Title);
|
||||||
series.Monitored = true;
|
movie.Monitored = true;
|
||||||
series.Seasons.ForEach(v => v.Monitored = true);
|
movie.AddOptions = new Core.Tv.AddMovieOptions();
|
||||||
series.AddOptions = new Core.Tv.AddSeriesOptions();
|
Directory.CreateDirectory(movie.Path);
|
||||||
Directory.CreateDirectory(series.Path);
|
|
||||||
|
|
||||||
result = Series.Post(series);
|
result = Movies.Post(movie);
|
||||||
Commands.WaitAll();
|
Commands.WaitAll();
|
||||||
WaitForCompletion(() => Episodes.GetEpisodesInSeries(result.Id).Count > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (monitored.HasValue)
|
if (monitored.HasValue)
|
||||||
|
@ -231,54 +227,45 @@ namespace NzbDrone.Integration.Test
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Seasons.ForEach(season =>
|
|
||||||
{
|
|
||||||
if (season.Monitored != monitored.Value)
|
|
||||||
{
|
|
||||||
season.Monitored = monitored.Value;
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
Series.Put(result);
|
Movies.Put(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnsureNoSeries(int tvdbId, string seriesTitle)
|
public void EnsureNoMovie(string imdbId, string movieTitle)
|
||||||
{
|
{
|
||||||
var result = Series.All().FirstOrDefault(v => v.TvdbId == tvdbId);
|
var result = Movies.All().FirstOrDefault(v => v.ImdbId == imdbId);
|
||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Series.Delete(result.Id);
|
Movies.Delete(result.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EpisodeFileResource EnsureEpisodeFile(SeriesResource series, int season, int episode, Quality quality)
|
public MovieFileResource EnsureMovieFile(MovieResource movie, Quality quality)
|
||||||
{
|
{
|
||||||
var result = Episodes.GetEpisodesInSeries(series.Id).Single(v => v.SeasonNumber == season && v.EpisodeNumber == episode);
|
var result = Movies.Get(movie.Id);
|
||||||
|
|
||||||
if (result.EpisodeFile == null)
|
if (result.MovieFile == null)
|
||||||
{
|
{
|
||||||
var path = Path.Combine(SeriesRootFolder, series.Title, string.Format("Series.S{0}E{1}.{2}.mkv", season, episode, quality.Name));
|
var path = Path.Combine(MovieRootFolder, movie.Title, string.Format("{0} - {1}.mkv", movie.Title, quality.Name));
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
File.WriteAllText(path, "Fake Episode");
|
File.WriteAllText(path, "Fake Movie");
|
||||||
|
|
||||||
Commands.PostAndWait(new CommandResource { Name = "refreshseries", Body = new RefreshSeriesCommand(series.Id) });
|
Commands.PostAndWait(new CommandResource { Name = "refreshmovie", Body = new RefreshMovieCommand(movie.Id) });
|
||||||
Commands.WaitAll();
|
Commands.WaitAll();
|
||||||
|
|
||||||
result = Episodes.GetEpisodesInSeries(series.Id).Single(v => v.SeasonNumber == season && v.EpisodeNumber == episode);
|
result = Movies.Get(movie.Id);
|
||||||
|
|
||||||
result.EpisodeFile.Should().NotBeNull();
|
result.MovieFile.Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.EpisodeFile;
|
return result.MovieFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileResource EnsureProfileCutoff(int profileId, Quality cutoff)
|
public ProfileResource EnsureProfileCutoff(int profileId, Quality cutoff)
|
||||||
|
|
|
@ -107,21 +107,19 @@
|
||||||
<Compile Include="ApiTests\CalendarFixture.cs" />
|
<Compile Include="ApiTests\CalendarFixture.cs" />
|
||||||
<Compile Include="ApiTests\BlacklistFixture.cs" />
|
<Compile Include="ApiTests\BlacklistFixture.cs" />
|
||||||
<Compile Include="ApiTests\DownloadClientFixture.cs" />
|
<Compile Include="ApiTests\DownloadClientFixture.cs" />
|
||||||
<Compile Include="ApiTests\EpisodeFileFixture.cs" />
|
<Compile Include="ApiTests\MovieFileFixture.cs" />
|
||||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||||
<Compile Include="ApiTests\SeriesLookupFixture.cs" />
|
<Compile Include="ApiTests\MovieLookupFixture.cs" />
|
||||||
<Compile Include="ApiTests\WantedFixture.cs" />
|
<Compile Include="ApiTests\WantedFixture.cs" />
|
||||||
<Compile Include="Client\ClientBase.cs" />
|
<Compile Include="Client\ClientBase.cs" />
|
||||||
<Compile Include="Client\EpisodeClient.cs" />
|
|
||||||
<Compile Include="Client\IndexerClient.cs" />
|
<Compile Include="Client\IndexerClient.cs" />
|
||||||
<Compile Include="Client\DownloadClientClient.cs" />
|
<Compile Include="Client\DownloadClientClient.cs" />
|
||||||
|
<Compile Include="Client\MovieClient.cs" />
|
||||||
<Compile Include="Client\NotificationClient.cs" />
|
<Compile Include="Client\NotificationClient.cs" />
|
||||||
<Compile Include="Client\CommandClient.cs" />
|
<Compile Include="Client\CommandClient.cs" />
|
||||||
<Compile Include="Client\ReleaseClient.cs" />
|
<Compile Include="Client\ReleaseClient.cs" />
|
||||||
<Compile Include="Client\SeriesClient.cs" />
|
|
||||||
<Compile Include="ApiTests\CommandFixture.cs" />
|
<Compile Include="ApiTests\CommandFixture.cs" />
|
||||||
<Compile Include="CorsFixture.cs" />
|
<Compile Include="CorsFixture.cs" />
|
||||||
<Compile Include="ApiTests\EpisodeFixture.cs" />
|
|
||||||
<Compile Include="ApiTests\HistoryFixture.cs" />
|
<Compile Include="ApiTests\HistoryFixture.cs" />
|
||||||
<Compile Include="ApiTests\IndexerFixture.cs" />
|
<Compile Include="ApiTests\IndexerFixture.cs" />
|
||||||
<Compile Include="HttpLogFixture.cs" />
|
<Compile Include="HttpLogFixture.cs" />
|
||||||
|
@ -133,8 +131,8 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ApiTests\ReleaseFixture.cs" />
|
<Compile Include="ApiTests\ReleaseFixture.cs" />
|
||||||
<Compile Include="ApiTests\RootFolderFixture.cs" />
|
<Compile Include="ApiTests\RootFolderFixture.cs" />
|
||||||
<Compile Include="ApiTests\SeriesEditorFixture.cs" />
|
<Compile Include="ApiTests\MovieEditorFixture.cs" />
|
||||||
<Compile Include="ApiTests\SeriesFixture.cs" />
|
<Compile Include="ApiTests\MovieFixture.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\NzbDrone.Test.Common\App.config">
|
<None Include="..\NzbDrone.Test.Common\App.config">
|
||||||
|
|
|
@ -3,7 +3,7 @@ var MovieModel = require('../Movies/MovieModel');
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
|
||||||
module.exports = Backbone.Collection.extend({
|
module.exports = Backbone.Collection.extend({
|
||||||
url : window.NzbDrone.ApiRoot + '/movies/lookup',
|
url : window.NzbDrone.ApiRoot + '/movie/lookup',
|
||||||
model : MovieModel,
|
model : MovieModel,
|
||||||
|
|
||||||
parse : function(response) {
|
parse : function(response) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ module.exports = NzbDroneCell.extend({
|
||||||
var data = field.val();
|
var data = field.val();
|
||||||
|
|
||||||
var promise = $.ajax({
|
var promise = $.ajax({
|
||||||
url : window.NzbDrone.ApiRoot + '/movies/lookup/tmdb?tmdbId=' + data,
|
url : window.NzbDrone.ApiRoot + '/movie/lookup/tmdb?tmdbId=' + data,
|
||||||
type : 'GET',
|
type : 'GET',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue