2013-07-18 20:47:55 -07:00
|
|
|
using NUnit.Framework;
|
2013-05-19 16:17:32 -07:00
|
|
|
using NzbDrone.Core.Notifications.Prowl;
|
2011-11-02 19:44:22 -07:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
2013-06-12 18:37:05 -07:00
|
|
|
namespace NzbDrone.Core.Test.NotificationTests
|
2011-11-02 19:44:22 -07:00
|
|
|
{
|
|
|
|
[Explicit]
|
|
|
|
[TestFixture]
|
2013-06-12 23:41:26 -07:00
|
|
|
public class ProwlProviderTest : CoreTest<ProwlService>
|
2011-11-02 19:44:22 -07:00
|
|
|
{
|
2013-06-12 23:41:26 -07:00
|
|
|
private const string _apiKey = "66e9f688b512152eb2688f0486ae542c76e564a2";
|
2011-11-02 19:44:22 -07:00
|
|
|
|
|
|
|
private const string _badApiKey = "1234567890abcdefghijklmnopqrstuvwxyz1234";
|
|
|
|
|
|
|
|
[Test]
|
2013-06-12 23:41:26 -07:00
|
|
|
public void Verify_should_not_throw_for_a_valid_apiKey()
|
2011-11-02 19:44:22 -07:00
|
|
|
{
|
2013-06-12 23:41:26 -07:00
|
|
|
Subject.Verify(_apiKey);
|
|
|
|
ExceptionVerification.ExpectedWarns(0);
|
2011-11-02 19:44:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2013-06-12 23:41:26 -07:00
|
|
|
public void Verify_should_throw_for_an_invalid_apiKey()
|
2011-11-02 19:44:22 -07:00
|
|
|
{
|
2013-06-12 23:41:26 -07:00
|
|
|
Assert.Throws<InvalidApiKeyException>(() => Subject.Verify(_badApiKey));
|
2013-03-28 15:07:09 -07:00
|
|
|
|
2011-12-19 16:58:26 -08:00
|
|
|
ExceptionVerification.ExpectedWarns(1);
|
2011-11-02 19:44:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2013-06-12 23:41:26 -07:00
|
|
|
public void SendNotification_should_not_throw_for_a_valid_apiKey()
|
2011-11-02 19:44:22 -07:00
|
|
|
{
|
2013-06-12 23:41:26 -07:00
|
|
|
Subject.SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey);
|
|
|
|
ExceptionVerification.ExpectedWarns(0);
|
2011-11-02 19:44:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
2013-06-12 23:41:26 -07:00
|
|
|
public void SendNotification_should_log_a_warning_for_an_invalid_apiKey()
|
2011-11-02 19:44:22 -07:00
|
|
|
{
|
2013-06-12 23:41:26 -07:00
|
|
|
Subject.SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _badApiKey);
|
2011-11-02 19:44:22 -07:00
|
|
|
|
2011-12-19 16:58:26 -08:00
|
|
|
ExceptionVerification.ExpectedWarns(1);
|
2011-11-02 19:44:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|