mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Fixed: Transmission proxy should no longer produce paths with double slashes.
This commit is contained in:
parent
0ee5261a2a
commit
cd79826aad
@ -19,6 +19,7 @@ public class TransmissionFixture : DownloadClientFixtureBase<Transmission>
|
||||
protected TransmissionTorrent _downloading;
|
||||
protected TransmissionTorrent _failed;
|
||||
protected TransmissionTorrent _completed;
|
||||
protected Dictionary<string, object> _transmissionConfigItems;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@ -87,15 +88,15 @@ public void Setup()
|
||||
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
|
||||
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new Byte[0]));
|
||||
|
||||
var configItems = new Dictionary<String, Object>();
|
||||
_transmissionConfigItems = new Dictionary<String, Object>();
|
||||
|
||||
configItems.Add("download-dir", @"C:/Downloads/Finished/transmission");
|
||||
configItems.Add("incomplete-dir", null);
|
||||
configItems.Add("incomplete-dir-enabled", false);
|
||||
_transmissionConfigItems.Add("download-dir", @"C:/Downloads/Finished/transmission");
|
||||
_transmissionConfigItems.Add("incomplete-dir", null);
|
||||
_transmissionConfigItems.Add("incomplete-dir-enabled", false);
|
||||
|
||||
Mocker.GetMock<ITransmissionProxy>()
|
||||
.Setup(v => v.GetConfig(It.IsAny<TransmissionSettings>()))
|
||||
.Returns(configItems);
|
||||
.Returns(_transmissionConfigItems);
|
||||
|
||||
}
|
||||
|
||||
@ -230,6 +231,24 @@ public void Download_with_category_should_force_directory()
|
||||
.Verify(v => v.AddTorrentFromData(It.IsAny<Byte[]>(), @"C:/Downloads/Finished/transmission/.nzbdrone", It.IsAny<TransmissionSettings>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_with_category_should_not_have_double_slashes()
|
||||
{
|
||||
GivenTvCategory();
|
||||
GivenSuccessfulDownload();
|
||||
|
||||
_transmissionConfigItems["download-dir"] += "/";
|
||||
|
||||
var remoteEpisode = CreateRemoteEpisode();
|
||||
|
||||
var id = Subject.Download(remoteEpisode);
|
||||
|
||||
id.Should().NotBeNullOrEmpty();
|
||||
|
||||
Mocker.GetMock<ITransmissionProxy>()
|
||||
.Verify(v => v.AddTorrentFromData(It.IsAny<Byte[]>(), @"C:/Downloads/Finished/transmission/.nzbdrone", It.IsAny<TransmissionSettings>()), Times.Once());
|
||||
}
|
||||
|
||||
[TestCase("magnet:?xt=urn:btih:ZPBPA2P6ROZPKRHK44D5OW6NHXU5Z6KR&tr=udp", "CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951")]
|
||||
public void Download_should_get_hash_from_magnet_url(String magnetUrl, String expectedHash)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ private String GetDownloadDirectory()
|
||||
var config = _proxy.GetConfig(Settings);
|
||||
var destDir = (String)config.GetValueOrDefault("download-dir");
|
||||
|
||||
return String.Format("{0}/.{1}", destDir, Settings.TvCategory);
|
||||
return string.Format("{0}/.{1}", destDir.TrimEnd('/'), Settings.TvCategory);
|
||||
}
|
||||
|
||||
public override IEnumerable<DownloadClientItem> GetItems()
|
||||
|
Loading…
Reference in New Issue
Block a user