mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-23 22:25:14 -04:00
Reformat and apply Stylecop rules
This commit is contained in:
-3
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -16,7 +15,6 @@ using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class UsenetBlackholeFixture : DownloadClientFixtureBase<UsenetBlackhole>
|
||||
{
|
||||
@@ -97,7 +95,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
VerifyPostprocessing(result);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_return_category()
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Deluge;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
|
||||
@@ -31,57 +31,57 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests
|
||||
};
|
||||
|
||||
_queued = new DelugeTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = false,
|
||||
State = DelugeTorrentStatus.Queued,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 0,
|
||||
Progress = 0.0,
|
||||
DownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = false,
|
||||
State = DelugeTorrentStatus.Queued,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 0,
|
||||
Progress = 0.0,
|
||||
DownloadPath = "somepath"
|
||||
};
|
||||
|
||||
_downloading = new DelugeTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = false,
|
||||
State = DelugeTorrentStatus.Downloading,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 100,
|
||||
Progress = 10.0,
|
||||
DownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = false,
|
||||
State = DelugeTorrentStatus.Downloading,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 100,
|
||||
Progress = 10.0,
|
||||
DownloadPath = "somepath"
|
||||
};
|
||||
|
||||
_failed = new DelugeTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = false,
|
||||
State = DelugeTorrentStatus.Error,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 100,
|
||||
Progress = 10.0,
|
||||
Message = "Error",
|
||||
DownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = false,
|
||||
State = DelugeTorrentStatus.Error,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 100,
|
||||
Progress = 10.0,
|
||||
Message = "Error",
|
||||
DownloadPath = "somepath"
|
||||
};
|
||||
|
||||
_completed = new DelugeTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = true,
|
||||
State = DelugeTorrentStatus.Paused,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 1000,
|
||||
Progress = 100.0,
|
||||
DownloadPath = "somepath",
|
||||
IsAutoManaged = true,
|
||||
StopAtRatio = true,
|
||||
StopRatio = 1.0,
|
||||
Ratio = 1.5
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
IsFinished = true,
|
||||
State = DelugeTorrentStatus.Paused,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
BytesDownloaded = 1000,
|
||||
Progress = 100.0,
|
||||
DownloadPath = "somepath",
|
||||
IsAutoManaged = true,
|
||||
StopAtRatio = true,
|
||||
StopRatio = 1.0,
|
||||
Ratio = 1.5
|
||||
};
|
||||
|
||||
Mocker.GetMock<ITorrentFileInfoReader>()
|
||||
.Setup(s => s.GetHashFromTorrentFile(It.IsAny<byte[]>()))
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.Map(It.IsAny<ParsedMovieInfo>(), It.IsAny<string>(), (SearchCriteriaBase)null))
|
||||
.Returns(() => new MappingResult{RemoteMovie = CreateRemoteMovie(), MappingResultType = MappingResultType.Success});
|
||||
.Returns(() => new MappingResult { RemoteMovie = CreateRemoteMovie(), MappingResultType = MappingResultType.Success });
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||
@@ -67,6 +67,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
{
|
||||
VerifyIdentifiable(downloadClientItem);
|
||||
downloadClientItem.RemainingSize.Should().NotBe(0);
|
||||
|
||||
//downloadClientItem.RemainingTime.Should().NotBe(TimeSpan.Zero);
|
||||
//downloadClientItem.OutputPath.Should().NotBeNullOrEmpty();
|
||||
downloadClientItem.Status.Should().Be(DownloadItemStatus.Queued);
|
||||
@@ -77,6 +78,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
VerifyIdentifiable(downloadClientItem);
|
||||
|
||||
downloadClientItem.RemainingSize.Should().NotBe(0);
|
||||
|
||||
//downloadClientItem.RemainingTime.Should().NotBe(TimeSpan.Zero);
|
||||
//downloadClientItem.OutputPath.Should().NotBeNullOrEmpty();
|
||||
downloadClientItem.Status.Should().Be(DownloadItemStatus.Paused);
|
||||
@@ -87,6 +89,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
VerifyIdentifiable(downloadClientItem);
|
||||
|
||||
downloadClientItem.RemainingSize.Should().NotBe(0);
|
||||
|
||||
//downloadClientItem.RemainingTime.Should().NotBe(TimeSpan.Zero);
|
||||
//downloadClientItem.OutputPath.Should().NotBeNullOrEmpty();
|
||||
downloadClientItem.Status.Should().Be(DownloadItemStatus.Downloading);
|
||||
@@ -108,6 +111,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
downloadClientItem.Title.Should().NotBeNullOrEmpty();
|
||||
downloadClientItem.RemainingSize.Should().Be(0);
|
||||
downloadClientItem.RemainingTime.Should().Be(TimeSpan.Zero);
|
||||
|
||||
//downloadClientItem.OutputPath.Should().NotBeNullOrEmpty();
|
||||
downloadClientItem.Status.Should().Be(DownloadItemStatus.Completed);
|
||||
}
|
||||
|
||||
+28
-28
@@ -67,13 +67,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "0"},
|
||||
{ "size_uploaded", "0"},
|
||||
{ "size_downloaded", "0" },
|
||||
{ "size_uploaded", "0" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -91,13 +91,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_uploaded", "100"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "size_uploaded", "100" },
|
||||
{ "speed_download", "0" }
|
||||
},
|
||||
}
|
||||
@@ -115,13 +115,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_uploaded", "100"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "size_uploaded", "100" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -139,13 +139,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "100"},
|
||||
{ "size_uploaded", "10"},
|
||||
{ "size_downloaded", "100" },
|
||||
{ "size_uploaded", "10" },
|
||||
{ "speed_download", "50" }
|
||||
}
|
||||
}
|
||||
@@ -163,13 +163,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "10"},
|
||||
{ "size_uploaded", "1"},
|
||||
{ "size_downloaded", "10" },
|
||||
{ "size_uploaded", "1" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -187,13 +187,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_uploaded", "100"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "size_uploaded", "100" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -211,13 +211,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_uploaded", "100"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "size_uploaded", "100" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -235,13 +235,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_uploaded", "100"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "size_uploaded", "100" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -259,13 +259,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", DownloadURL }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_uploaded", "100"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "size_uploaded", "100" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -587,7 +587,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
|
||||
[TestCase(DownloadStationTaskStatus.Downloading, false, false)]
|
||||
[TestCase(DownloadStationTaskStatus.Finished, true, true)]
|
||||
[TestCase(DownloadStationTaskStatus.Seeding, true, false)]
|
||||
[TestCase(DownloadStationTaskStatus.Seeding, true, false)]
|
||||
[TestCase(DownloadStationTaskStatus.Waiting, false, false)]
|
||||
public void GetItems_should_return_canBeMoved_and_canBeDeleted_as_expected(DownloadStationTaskStatus apiStatus, bool canMoveFilesExpected, bool canBeRemovedExpected)
|
||||
{
|
||||
|
||||
+12
-13
@@ -9,9 +9,9 @@ using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.Organizer;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
@@ -64,12 +64,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", CleanFileName(_remoteEpisode.Release.Title) }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "0"},
|
||||
{ "size_downloaded", "0" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -87,12 +87,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", CleanFileName(_remoteEpisode.Release.Title) }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "speed_download", "0" }
|
||||
},
|
||||
}
|
||||
@@ -110,12 +110,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", CleanFileName(_remoteEpisode.Release.Title) }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "1000"},
|
||||
{ "size_downloaded", "1000" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -133,12 +133,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", CleanFileName(_remoteEpisode.Release.Title) }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "100"},
|
||||
{ "size_downloaded", "100" },
|
||||
{ "speed_download", "50" }
|
||||
}
|
||||
}
|
||||
@@ -156,12 +156,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
Detail = new Dictionary<string, string>
|
||||
{
|
||||
{ "destination","shared/folder" },
|
||||
{ "destination", "shared/folder" },
|
||||
{ "uri", CleanFileName(_remoteEpisode.Release.Title) }
|
||||
},
|
||||
Transfer = new Dictionary<string, string>
|
||||
{
|
||||
{ "size_downloaded", "10"},
|
||||
{ "size_downloaded", "10" },
|
||||
{ "speed_download", "0" }
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[1000]));
|
||||
*/
|
||||
|
||||
Mocker.GetMock<IDownloadStationTaskProxy>()
|
||||
.Setup(s => s.AddTaskFromData(It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<DownloadStationSettings>()))
|
||||
.Callback(PrepareClientToReturnQueuedItem);
|
||||
@@ -246,7 +245,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Returns(tasks);
|
||||
}
|
||||
|
||||
protected static string CleanFileName(String name)
|
||||
protected static string CleanFileName(string name)
|
||||
{
|
||||
return FileNameBuilder.CleanFileName(name) + ".nzb";
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,14 +1,14 @@
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Hadouken;
|
||||
using NzbDrone.Core.Download.Clients.Hadouken.Models;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests
|
||||
@@ -81,7 +81,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests
|
||||
};
|
||||
|
||||
Mocker.GetMock<ITorrentFileInfoReader>()
|
||||
.Setup(s => s.GetHashFromTorrentFile(It.IsAny<Byte[]>()))
|
||||
.Setup(s => s.GetHashFromTorrentFile(It.IsAny<byte[]>()))
|
||||
.Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951");
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
@@ -210,7 +210,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests
|
||||
[Test]
|
||||
public void should_return_status_with_outputdirs()
|
||||
{
|
||||
var configItems = new Dictionary<String, Object>();
|
||||
var configItems = new Dictionary<string, object>();
|
||||
|
||||
configItems.Add("bittorrent.defaultSavePath", @"C:\Downloads\Downloading\deluge".AsOsAgnostic());
|
||||
|
||||
|
||||
+35
-35
@@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
using NzbDrone.Core.Download.Clients.NzbVortex;
|
||||
using NzbDrone.Core.Download.Clients.NzbVortex.Responses;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests
|
||||
{
|
||||
@@ -28,42 +28,42 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests
|
||||
{
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = new NzbVortexSettings
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
ApiKey = "1234-ABCD",
|
||||
TvCategory = "tv",
|
||||
RecentMoviePriority = (int)NzbgetPriority.High
|
||||
};
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
ApiKey = "1234-ABCD",
|
||||
TvCategory = "tv",
|
||||
RecentMoviePriority = (int)NzbgetPriority.High
|
||||
};
|
||||
|
||||
_queued = new NzbVortexQueueItem
|
||||
{
|
||||
Id = RandomNumber,
|
||||
DownloadedSize = 1000,
|
||||
TotalDownloadSize = 10,
|
||||
GroupName = "tv",
|
||||
UiTitle = "Droned.1998.1080p.WEB-DL-DRONE"
|
||||
};
|
||||
{
|
||||
Id = RandomNumber,
|
||||
DownloadedSize = 1000,
|
||||
TotalDownloadSize = 10,
|
||||
GroupName = "tv",
|
||||
UiTitle = "Droned.1998.1080p.WEB-DL-DRONE"
|
||||
};
|
||||
|
||||
_failed = new NzbVortexQueueItem
|
||||
{
|
||||
DownloadedSize = 1000,
|
||||
TotalDownloadSize = 1000,
|
||||
GroupName = "tv",
|
||||
UiTitle = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestinationPath = "somedirectory",
|
||||
State = NzbVortexStateType.UncompressFailed,
|
||||
};
|
||||
{
|
||||
DownloadedSize = 1000,
|
||||
TotalDownloadSize = 1000,
|
||||
GroupName = "tv",
|
||||
UiTitle = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestinationPath = "somedirectory",
|
||||
State = NzbVortexStateType.UncompressFailed,
|
||||
};
|
||||
|
||||
_completed = new NzbVortexQueueItem
|
||||
{
|
||||
DownloadedSize = 1000,
|
||||
TotalDownloadSize = 1000,
|
||||
GroupName = "tv",
|
||||
UiTitle = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestinationPath = "/remote/mount/tv/Droned.1998.1080p.WEB-DL-DRONE",
|
||||
State = NzbVortexStateType.Done
|
||||
};
|
||||
{
|
||||
DownloadedSize = 1000,
|
||||
TotalDownloadSize = 1000,
|
||||
GroupName = "tv",
|
||||
UiTitle = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestinationPath = "/remote/mount/tv/Droned.1998.1080p.WEB-DL-DRONE",
|
||||
State = NzbVortexStateType.Done
|
||||
};
|
||||
}
|
||||
|
||||
protected void GivenFailedDownload()
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Nzbget;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
{
|
||||
@@ -26,53 +26,53 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
{
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = new NzbgetSettings
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
Username = "admin",
|
||||
Password = "pass",
|
||||
MovieCategory = "movie",
|
||||
RecentMoviePriority = (int)NzbgetPriority.High
|
||||
};
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
Username = "admin",
|
||||
Password = "pass",
|
||||
MovieCategory = "movie",
|
||||
RecentMoviePriority = (int)NzbgetPriority.High
|
||||
};
|
||||
|
||||
_queued = new NzbgetQueueItem
|
||||
{
|
||||
FileSizeLo = 1000,
|
||||
RemainingSizeLo = 10,
|
||||
Category = "movie",
|
||||
NzbName = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } }
|
||||
};
|
||||
{
|
||||
FileSizeLo = 1000,
|
||||
RemainingSizeLo = 10,
|
||||
Category = "movie",
|
||||
NzbName = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } }
|
||||
};
|
||||
|
||||
_failed = new NzbgetHistoryItem
|
||||
{
|
||||
FileSizeLo = 1000,
|
||||
Category = "movie",
|
||||
Name = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestDir = "somedirectory",
|
||||
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
|
||||
ParStatus = "Some Error",
|
||||
UnpackStatus = "NONE",
|
||||
MoveStatus = "NONE",
|
||||
ScriptStatus = "NONE",
|
||||
DeleteStatus = "NONE",
|
||||
MarkStatus = "NONE"
|
||||
};
|
||||
{
|
||||
FileSizeLo = 1000,
|
||||
Category = "movie",
|
||||
Name = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestDir = "somedirectory",
|
||||
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
|
||||
ParStatus = "Some Error",
|
||||
UnpackStatus = "NONE",
|
||||
MoveStatus = "NONE",
|
||||
ScriptStatus = "NONE",
|
||||
DeleteStatus = "NONE",
|
||||
MarkStatus = "NONE"
|
||||
};
|
||||
|
||||
_completed = new NzbgetHistoryItem
|
||||
{
|
||||
FileSizeLo = 1000,
|
||||
Category = "movie",
|
||||
Name = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestDir = "/remote/mount/tv/Droned.1998.1080p.WEB-DL-DRONE",
|
||||
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
|
||||
ParStatus = "SUCCESS",
|
||||
UnpackStatus = "NONE",
|
||||
MoveStatus = "SUCCESS",
|
||||
ScriptStatus = "NONE",
|
||||
DeleteStatus = "NONE",
|
||||
MarkStatus = "NONE"
|
||||
};
|
||||
{
|
||||
FileSizeLo = 1000,
|
||||
Category = "movie",
|
||||
Name = "Droned.1998.1080p.WEB-DL-DRONE",
|
||||
DestDir = "/remote/mount/tv/Droned.1998.1080p.WEB-DL-DRONE",
|
||||
Parameters = new List<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
|
||||
ParStatus = "SUCCESS",
|
||||
UnpackStatus = "NONE",
|
||||
MoveStatus = "SUCCESS",
|
||||
ScriptStatus = "NONE",
|
||||
DeleteStatus = "NONE",
|
||||
MarkStatus = "NONE"
|
||||
};
|
||||
|
||||
Mocker.GetMock<INzbgetProxy>()
|
||||
.Setup(s => s.GetGlobalStatus(It.IsAny<NzbgetSettings>()))
|
||||
@@ -81,7 +81,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
DownloadRate = 7000000
|
||||
});
|
||||
|
||||
|
||||
Mocker.GetMock<INzbgetProxy>()
|
||||
.Setup(v => v.GetVersion(It.IsAny<NzbgetSettings>()))
|
||||
.Returns("14.0");
|
||||
@@ -321,7 +320,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
{
|
||||
// TODO: We would love to have a way to distinguish between scripts reporting video corruption, or some internal script error.
|
||||
// That way we could return Warning instead of Failed to notify the user to take action.
|
||||
|
||||
_completed.ScriptStatus = "FAILURE";
|
||||
|
||||
GivenQueue(null);
|
||||
|
||||
@@ -58,7 +58,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_throw_on_failed_download()
|
||||
{
|
||||
|
||||
+15
-14
@@ -1,15 +1,15 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.QBittorrent;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
{
|
||||
@@ -30,12 +30,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
};
|
||||
|
||||
Mocker.GetMock<ITorrentFileInfoReader>()
|
||||
.Setup(s => s.GetHashFromTorrentFile(It.IsAny<Byte[]>()))
|
||||
.Setup(s => s.GetHashFromTorrentFile(It.IsAny<byte[]>()))
|
||||
.Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951");
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new Byte[0]));
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new byte[0]));
|
||||
|
||||
Mocker.GetMock<IQBittorrentProxy>()
|
||||
.Setup(s => s.GetConfig(It.IsAny<QBittorrentSettings>()))
|
||||
@@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new Byte[0], System.Net.HttpStatusCode.SeeOther));
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.SeeOther));
|
||||
}
|
||||
|
||||
protected void GivenRedirectToTorrent()
|
||||
@@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl)))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new Byte[0], System.Net.HttpStatusCode.Found));
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, httpHeader, new byte[0], System.Net.HttpStatusCode.Found));
|
||||
}
|
||||
|
||||
protected void GivenFailedDownload()
|
||||
@@ -96,8 +96,8 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
|
||||
protected void GivenHighPriority()
|
||||
{
|
||||
Subject.Definition.Settings.As<QBittorrentSettings>().OlderMoviePriority = (int) QBittorrentPriority.First;
|
||||
Subject.Definition.Settings.As<QBittorrentSettings>().RecentMoviePriority = (int) QBittorrentPriority.First;
|
||||
Subject.Definition.Settings.As<QBittorrentSettings>().OlderMoviePriority = (int)QBittorrentPriority.First;
|
||||
Subject.Definition.Settings.As<QBittorrentSettings>().RecentMoviePriority = (int)QBittorrentPriority.First;
|
||||
}
|
||||
|
||||
protected void GivenGlobalSeedLimits(float maxRatio, int maxSeedingTime = -1, bool removeOnMaxRatio = false)
|
||||
@@ -117,7 +117,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
protected virtual void GivenTorrents(List<QBittorrentTorrent> torrents)
|
||||
{
|
||||
if (torrents == null)
|
||||
{
|
||||
torrents = new List<QBittorrentTorrent>();
|
||||
}
|
||||
|
||||
Mocker.GetMock<IQBittorrentProxy>()
|
||||
.Setup(s => s.GetTorrents(It.IsAny<QBittorrentSettings>()))
|
||||
@@ -414,8 +416,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
|
||||
protected virtual QBittorrentTorrent GivenCompletedTorrent(
|
||||
string state = "pausedUP",
|
||||
float ratio = 0.1f, float ratioLimit = -2,
|
||||
int seedingTime = 1, int seedingTimeLimit = -2)
|
||||
float ratio = 0.1f,
|
||||
float ratioLimit = -2,
|
||||
int seedingTime = 1,
|
||||
int seedingTimeLimit = -2)
|
||||
{
|
||||
var torrent = new QBittorrentTorrent
|
||||
{
|
||||
@@ -500,7 +504,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
item.CanMoveFiles.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_not_be_removable_and_should_not_allow_move_files_if_max_seedingtime_reached_and_not_paused()
|
||||
{
|
||||
@@ -628,11 +631,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
// Let this stand as a lesson to never write temporary unit tests on your dev machine and claim it works.
|
||||
// Commit the tests and let it run with the official build on the official build agents.
|
||||
// (Also don't replace library versions in your build script)
|
||||
|
||||
var json = "{ \"eta\": 18446744073709335000 }";
|
||||
var torrent = Newtonsoft.Json.JsonConvert.DeserializeObject<QBittorrentTorrent>(json);
|
||||
torrent.Eta.ToString().Should().Be("18446744073709335000");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
+2
-3
@@ -1,11 +1,11 @@
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.RTorrent;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.RTorrentTests
|
||||
{
|
||||
@@ -61,7 +61,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.RTorrentTests
|
||||
.Setup(s => s.AddTorrentFromFile(It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<string>(), It.IsAny<RTorrentPriority>(), It.IsAny<string>(), It.IsAny<RTorrentSettings>()))
|
||||
.Callback(PrepareClientToReturnCompletedItem);
|
||||
|
||||
|
||||
Mocker.GetMock<IRTorrentProxy>()
|
||||
.Setup(s => s.HasHashTorrent(It.IsAny<string>(), It.IsAny<RTorrentSettings>()))
|
||||
.Returns(true);
|
||||
|
||||
+3
-3
@@ -15,9 +15,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests.JsonConve
|
||||
[TestCase("0:1:59", 119)]
|
||||
[TestCase("0:59:59", 3599)]
|
||||
[TestCase("1:0:0", 3600)]
|
||||
[TestCase("1:0:0:1", 24 * 3600 + 1)]
|
||||
[TestCase("40:12:14", 40 * 3600 + 12 * 60 + 14)]
|
||||
[TestCase("1:16:12:14", 40 * 3600 + 12 * 60 + 14)]
|
||||
[TestCase("1:0:0:1", (24 * 3600) + 1)]
|
||||
[TestCase("40:12:14", (40 * 3600) + (12 * 60) + 14)]
|
||||
[TestCase("1:16:12:14", (40 * 3600) + (12 * 60) + 14)]
|
||||
public void valid_time_formats_should_be_parsed_correctly(string time, int expectedSeconds)
|
||||
{
|
||||
var thing = string.Format(QUERY, time);
|
||||
|
||||
+34
-32
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd.Responses;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
{
|
||||
@@ -28,20 +28,20 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
{
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = new SabnzbdSettings
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
ApiKey = "5c770e3197e4fe763423ee7c392c25d1",
|
||||
Username = "admin",
|
||||
Password = "pass",
|
||||
MovieCategory = "movie",
|
||||
RecentMoviePriority = (int)SabnzbdPriority.High
|
||||
};
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
ApiKey = "5c770e3197e4fe763423ee7c392c25d1",
|
||||
Username = "admin",
|
||||
Password = "pass",
|
||||
MovieCategory = "movie",
|
||||
RecentMoviePriority = (int)SabnzbdPriority.High
|
||||
};
|
||||
_queued = new SabnzbdQueue
|
||||
{
|
||||
DefaultRootFolder = @"Y:\nzbget\root".AsOsAgnostic(),
|
||||
Paused = false,
|
||||
Items = new List<SabnzbdQueueItem>()
|
||||
{
|
||||
DefaultRootFolder = @"Y:\nzbget\root".AsOsAgnostic(),
|
||||
Paused = false,
|
||||
Items = new List<SabnzbdQueueItem>()
|
||||
{
|
||||
new SabnzbdQueueItem
|
||||
{
|
||||
@@ -54,11 +54,11 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
Title = "Droned.1998.1080p.WEB-DL-DRONE"
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
_failed = new SabnzbdHistory
|
||||
{
|
||||
Items = new List<SabnzbdHistoryItem>()
|
||||
{
|
||||
Items = new List<SabnzbdHistoryItem>()
|
||||
{
|
||||
new SabnzbdHistoryItem
|
||||
{
|
||||
@@ -69,11 +69,11 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
Title = "Droned.1998.1080p.WEB-DL-DRONE"
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
_completed = new SabnzbdHistory
|
||||
{
|
||||
Items = new List<SabnzbdHistoryItem>()
|
||||
{
|
||||
Items = new List<SabnzbdHistoryItem>()
|
||||
{
|
||||
new SabnzbdHistoryItem
|
||||
{
|
||||
@@ -85,19 +85,19 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
Storage = "/remote/mount/vv/Droned.1998.1080p.WEB-DL-DRONE"
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
_config = new SabnzbdConfig
|
||||
{
|
||||
Misc = new SabnzbdConfigMisc
|
||||
{
|
||||
Misc = new SabnzbdConfigMisc
|
||||
{
|
||||
complete_dir = @"/remote/mount"
|
||||
},
|
||||
Categories = new List<SabnzbdCategory>
|
||||
complete_dir = @"/remote/mount"
|
||||
},
|
||||
Categories = new List<SabnzbdCategory>
|
||||
{
|
||||
new SabnzbdCategory { Name = "movie", Dir = "vv" }
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Mocker.GetMock<ISabnzbdProxy>()
|
||||
.Setup(v => v.GetVersion(It.IsAny<SabnzbdSettings>()))
|
||||
@@ -108,9 +108,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
.Returns(_config);
|
||||
|
||||
_fullStatus = new SabnzbdFullStatus
|
||||
{
|
||||
CompleteDir = @"Y:\sabnzbd\root\complete".AsOsAgnostic()
|
||||
};
|
||||
{
|
||||
CompleteDir = @"Y:\sabnzbd\root\complete".AsOsAgnostic()
|
||||
};
|
||||
|
||||
Mocker.GetMock<ISabnzbdProxy>()
|
||||
.Setup(s => s.GetFullStatus(It.IsAny<SabnzbdSettings>()))
|
||||
@@ -161,7 +161,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
protected virtual void GivenHistory(SabnzbdHistory history)
|
||||
{
|
||||
if (history == null)
|
||||
{
|
||||
history = new SabnzbdHistory() { Items = new List<SabnzbdHistoryItem>() };
|
||||
}
|
||||
|
||||
Mocker.GetMock<ISabnzbdProxy>()
|
||||
.Setup(s => s.GetHistory(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<SabnzbdSettings>()))
|
||||
|
||||
+1
-3
@@ -284,7 +284,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||
item.RemainingTime.Should().NotHaveValue();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_not_be_removable_and_should_not_allow_move_files_if_max_ratio_reached_and_not_stopped()
|
||||
{
|
||||
@@ -340,7 +339,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||
item.CanMoveFiles.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_not_be_removable_and_should_not_allow_move_files_if_max_idletime_reached_and_not_paused()
|
||||
{
|
||||
@@ -389,7 +387,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||
public void should_not_be_removable_if_overridden_max_idletime_not_reached_and_paused()
|
||||
{
|
||||
GivenGlobalSeedLimits(null, 20);
|
||||
PrepareClientToReturnCompletedItem(true, ratio: 2.0, seedingTime: 30, idleLimit: 40);
|
||||
PrepareClientToReturnCompletedItem(true, ratio: 2.0, seedingTime: 30, idleLimit: 40);
|
||||
|
||||
var item = Subject.GetItems().Single();
|
||||
item.CanBeRemoved.Should().BeFalse();
|
||||
|
||||
+3
-2
@@ -110,7 +110,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||
Mocker.GetMock<ITransmissionProxy>()
|
||||
.Setup(v => v.GetConfig(It.IsAny<TransmissionSettings>()))
|
||||
.Returns(() => Json.Deserialize<TransmissionConfig>(_transmissionConfigItems.ToJson()));
|
||||
|
||||
}
|
||||
|
||||
protected void GivenMovieCategory()
|
||||
@@ -184,7 +183,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||
protected void PrepareClientToReturnCompletedItem(bool stopped = false, double ratio = 0.9, int seedingTime = 60, double? ratioLimit = null, int? idleLimit = null)
|
||||
{
|
||||
if (stopped)
|
||||
{
|
||||
_completed.Status = TransmissionTorrentStatus.Stopped;
|
||||
}
|
||||
|
||||
_completed.UploadedEver = (int)(_completed.DownloadedEver * ratio);
|
||||
_completed.SecondsSeeding = seedingTime * 60;
|
||||
|
||||
@@ -214,7 +216,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GivenTorrents(new List<TransmissionTorrent>
|
||||
{
|
||||
_completed
|
||||
|
||||
+53
-53
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.UTorrent;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
|
||||
@@ -25,65 +25,65 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
|
||||
{
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = new UTorrentSettings
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
Username = "admin",
|
||||
Password = "pass",
|
||||
MovieCategory = "movie"
|
||||
};
|
||||
{
|
||||
Host = "127.0.0.1",
|
||||
Port = 2222,
|
||||
Username = "admin",
|
||||
Password = "pass",
|
||||
MovieCategory = "movie"
|
||||
};
|
||||
|
||||
_queued = new UTorrentTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Queued | UTorrentTorrentStatus.Loaded,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 1000,
|
||||
Progress = 0,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Queued | UTorrentTorrentStatus.Loaded,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 1000,
|
||||
Progress = 0,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
|
||||
_downloading = new UTorrentTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Started | UTorrentTorrentStatus.Loaded,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 100,
|
||||
Progress = 0.9,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Started | UTorrentTorrentStatus.Loaded,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 100,
|
||||
Progress = 0.9,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
|
||||
_failed = new UTorrentTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Error,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 100,
|
||||
Progress = 0.9,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Error,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 100,
|
||||
Progress = 0.9,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
|
||||
_completed = new UTorrentTorrent
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Checked | UTorrentTorrentStatus.Loaded,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 0,
|
||||
Progress = 1.0,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
{
|
||||
Hash = "HASH",
|
||||
Status = UTorrentTorrentStatus.Checked | UTorrentTorrentStatus.Loaded,
|
||||
Name = _title,
|
||||
Size = 1000,
|
||||
Remaining = 0,
|
||||
Progress = 1.0,
|
||||
Label = "movie",
|
||||
DownloadUrl = _downloadUrl,
|
||||
RootDownloadPath = "somepath"
|
||||
};
|
||||
|
||||
Mocker.GetMock<ITorrentFileInfoReader>()
|
||||
.Setup(s => s.GetHashFromTorrentFile(It.IsAny<byte[]>()))
|
||||
|
||||
@@ -341,6 +341,5 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests
|
||||
items.Should().HaveCount(1);
|
||||
items.First().OutputPath.Should().Be(@"C:\Downloads\" + fileName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user