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