New: Newznab providers will be rejected if they are not valid addresses.

Tests added for checking DNS.
This commit is contained in:
Mark McDowall 2012-05-11 10:26:56 -07:00
commit 7a80c81ffb
3 changed files with 47 additions and 3 deletions

View file

@ -9,6 +9,7 @@ using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests
@ -295,5 +296,19 @@ namespace NzbDrone.Core.Test.ProviderTests
var result = db.Fetch<NewznabDefinition>();
result.Should().HaveCount(2);
}
[Test]
public void CheckHostname_should_do_nothing_if_hostname_is_valid()
{
Mocker.Resolve<NewznabProvider>().CheckHostname("http://www.google.com");
}
[Test]
[ExpectedException("System.Net.Sockets.SocketException")]
public void CheckHostname_should_log_error_and_throw_exception_if_dnsHostname_is_invalid()
{
Mocker.Resolve<NewznabProvider>().CheckHostname("http://BadName");
ExceptionVerification.ExpectedErrors(1);
}
}
}