1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Core.Test/NotificationTests/ProwlProviderTest.cs

48 lines
1.4 KiB
C#
Raw Normal View History

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;
namespace NzbDrone.Core.Test.NotificationTests
2011-11-03 05:44:22 +03:00
{
[Explicit]
[TestFixture]
public class ProwlProviderTest : CoreTest<ProwlService>
2011-11-03 05:44:22 +03:00
{
private const string _apiKey = "66e9f688b512152eb2688f0486ae542c76e564a2";
2011-11-03 05:44:22 +03:00
private const string _badApiKey = "1234567890abcdefghijklmnopqrstuvwxyz1234";
[Test]
public void Verify_should_not_throw_for_a_valid_apiKey()
2011-11-03 05:44:22 +03:00
{
Subject.Verify(_apiKey);
ExceptionVerification.ExpectedWarns(0);
2011-11-03 05:44:22 +03:00
}
[Test]
public void Verify_should_throw_for_an_invalid_apiKey()
2011-11-03 05:44:22 +03:00
{
Assert.Throws<InvalidApiKeyException>(() => Subject.Verify(_badApiKey));
2013-03-29 01:07:09 +03:00
ExceptionVerification.ExpectedWarns(1);
2011-11-03 05:44:22 +03:00
}
[Test]
public void SendNotification_should_not_throw_for_a_valid_apiKey()
2011-11-03 05:44:22 +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]
public void SendNotification_should_log_a_warning_for_an_invalid_apiKey()
2011-11-03 05:44:22 +03:00
{
Subject.SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _badApiKey);
2011-11-03 05:44:22 +03:00
ExceptionVerification.ExpectedWarns(1);
2011-11-03 05:44:22 +03:00
}
}
}