1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-20 21:55:03 -04:00

Big Abstraction for IMDBWatchlist -> RSSImport (With a test)

This commit is contained in:
Leonardo Galli
2017-01-21 20:29:31 +01:00
parent 734a36de06
commit a98b69859c
17 changed files with 2104 additions and 118 deletions
@@ -0,0 +1,34 @@
using System.Linq;
using System.Text;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.NetImport;
using NzbDrone.Core.NetImport.RSSImport;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.NetImport
{
public class RSSImportTest : CoreTest<RSSImportParser>
{
private NetImportResponse CreateResponse(string url, string content)
{
var httpRequest = new HttpRequest(url);
var httpResponse = new HttpResponse(httpRequest, new HttpHeader(), Encoding.UTF8.GetBytes(content));
return new NetImportResponse(new NetImportRequest(httpRequest), httpResponse);
}
[Test]
public void should_handle_relative_url()
{
var xml = ReadAllText("Files/imdb_watchlist.xml");
var result = Subject.ParseResponse(CreateResponse("http://my.indexer.com/api?q=My+Favourite+Show", xml));
result.First().Title.Should().Be("Think Like a Man Too");
}
}
}