2014-07-20 12:14:47 +00:00
|
|
|
|
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
|
|
|
|
|
{
|
2014-05-13 17:57:46 +00:00
|
|
|
|
// Indexer Urls
|
|
|
|
|
[TestCase(@"https://iptorrents.com/torrents/rss?u=mySecret;tp=mySecret;l5;download")]
|
|
|
|
|
[TestCase(@"http://rss.torrentleech.org/mySecret")]
|
|
|
|
|
[TestCase(@"http://www.bitmetv.org/rss.php?uid=mySecret&passkey=mySecret")]
|
2014-07-20 12:14:47 +00:00
|
|
|
|
// NzbGet
|
|
|
|
|
[TestCase(@"{ ""Name"" : ""ControlUsername"", ""Value"" : ""mySecret"" }, { ""Name"" : ""ControlPassword"", ""Value"" : ""mySecret"" }, ")]
|
|
|
|
|
[TestCase(@"{ ""Name"" : ""Server1.Username"", ""Value"" : ""mySecret"" }, { ""Name"" : ""Server1.Password"", ""Value"" : ""mySecret"" }, ")]
|
|
|
|
|
// Sabnzbd
|
2014-05-13 17:57:46 +00:00
|
|
|
|
[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")]
|
2014-07-20 12:14:47 +00:00
|
|
|
|
[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""}")]
|
2014-05-13 17:57:46 +00:00
|
|
|
|
// uTorrent
|
|
|
|
|
[TestCase(@"http://localhost:9091/gui/?token=wThmph5l0ZXfH-a6WOA4lqiLvyjCP0FpMrMeXmySecret_VXBO11HoKL751MAAAAA&list=1")]
|
|
|
|
|
[TestCase(@",[""boss_key"",0,""mySecret"",{""access"":""Y""}],[""boss_key_salt"",0,""mySecret"",{""access"":""W""}]")]
|
|
|
|
|
[TestCase(@",[""webui.username"",2,""mySecret"",{""access"":""Y""}],[""webui.password"",2,""mySecret"",{""access"":""Y""}]")]
|
|
|
|
|
[TestCase(@",[""webui.uconnect_username"",2,""mySecret"",{""access"":""Y""}],[""webui.uconnect_password"",2,""mySecret"",{""access"":""Y""}]")]
|
|
|
|
|
[TestCase(@",[""proxy.proxy"",2,""mySecret"",{""access"":""Y""}]")]
|
|
|
|
|
[TestCase(@",[""proxy.username"",2,""mySecret"",{""access"":""Y""}],[""proxy.password"",2,""mySecret"",{""access"":""Y""}]")]
|
|
|
|
|
// Deluge
|
|
|
|
|
[TestCase(@",{""download_location"": ""C:\Users\\mySecret mySecret\\Downloads""}")]
|
|
|
|
|
[TestCase(@",{""download_location"": ""/home/mySecret/Downloads""}")]
|
|
|
|
|
// BroadcastheNet
|
|
|
|
|
[TestCase(@"method: ""getTorrents"", ""params"": [ ""mySecret"",")]
|
|
|
|
|
[TestCase(@"""DownloadURL"":""https:\/\/broadcasthe.net\/torrents.php?action=download&id=123&authkey=mySecret&torrent_pass=mySecret""")]
|
2014-07-20 12:14:47 +00:00
|
|
|
|
public void should_clean_message(String message)
|
|
|
|
|
{
|
|
|
|
|
var cleansedMessage = CleanseLogMessage.Cleanse(message);
|
|
|
|
|
|
|
|
|
|
cleansedMessage.Should().NotContain("mySecret");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|