|
|
|
@ -0,0 +1,34 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Common.Instrumentation;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Common.Test.InstrumentationTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class CleanseLogMessageFixture
|
|
|
|
|
{
|
|
|
|
|
[TestCase(@"http://127.0.0.1:1234/api/call?vv=1&apikey=mySecret")]
|
|
|
|
|
[TestCase(@"http://127.0.0.1:1234/api/call?vv=1&ma_username=mySecret&ma_password=mySecret")]
|
|
|
|
|
// NzbGet
|
|
|
|
|
[TestCase(@"{ ""Name"" : ""ControlUsername"", ""Value"" : ""mySecret"" }, { ""Name"" : ""ControlPassword"", ""Value"" : ""mySecret"" }, ")]
|
|
|
|
|
[TestCase(@"{ ""Name"" : ""Server1.Username"", ""Value"" : ""mySecret"" }, { ""Name"" : ""Server1.Password"", ""Value"" : ""mySecret"" }, ")]
|
|
|
|
|
// Sabnzbd
|
|
|
|
|
[TestCase(@"""config"":{""newzbin"":{""username"":""mySecret"",""password"":""mySecret""}")]
|
|
|
|
|
[TestCase(@"""nzbxxx"":{""username"":""mySecret"",""apikey"":""mySecret""}")]
|
|
|
|
|
[TestCase(@"""growl"":{""growl_password"":""mySecret"",""growl_server"":""""}")]
|
|
|
|
|
[TestCase(@"""nzbmatrix"":{""username"":""mySecret"",""apikey"":""mySecret""}")]
|
|
|
|
|
[TestCase(@"""misc"":{""username"":""mySecret"",""api_key"":""mySecret"",""password"":""mySecret"",""nzb_key"":""mySecret""}")]
|
|
|
|
|
[TestCase(@"""servers"":[{""username"":""mySecret"",""password"":""mySecret""}]")]
|
|
|
|
|
[TestCase(@"""misc"":{""email_account"":""mySecret"",""email_to"":[],""email_from"":"""",""email_pwd"":""mySecret""}")]
|
|
|
|
|
public void should_clean_message(String message)
|
|
|
|
|
{
|
|
|
|
|
var cleansedMessage = CleanseLogMessage.Cleanse(message);
|
|
|
|
|
|
|
|
|
|
cleansedMessage.Should().NotContain("mySecret");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|