mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Skipping free space check when importing existing episodes
This commit is contained in:
parent
6850d77dd2
commit
89d603d71c
@ -39,7 +39,7 @@ public void Setup()
|
||||
|
||||
_localEpisode = new LocalEpisode
|
||||
{
|
||||
Path = @"C:\Test\30 Rock\30.rock.s01e01.avi",
|
||||
Path = @"C:\Test\Unsorted\30 Rock\30.rock.s01e01.avi".AsOsAgnostic(),
|
||||
Episodes = episodes,
|
||||
Series = _series
|
||||
};
|
||||
@ -98,7 +98,6 @@ public void should_use_series_paths_parent_for_free_space_check()
|
||||
.Verify(v => v.GetAvailableSpace(_rootFolder), Times.Once());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void should_pass_if_free_space_is_null()
|
||||
{
|
||||
@ -114,11 +113,24 @@ public void should_pass_if_exception_is_thrown()
|
||||
GivenFileSize(100.Megabytes());
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.GetAvailableSpace(It.IsAny<String>()))
|
||||
.Throws(new TestException());
|
||||
.Setup(s => s.GetAvailableSpace(It.IsAny<String>()))
|
||||
.Throws(new TestException());
|
||||
|
||||
Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue();
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_check_for_files_under_series_folder()
|
||||
{
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.IsParent(It.IsAny<String>(), It.IsAny<String>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(s => s.GetAvailableSpace(It.IsAny<String>()), Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,12 @@ public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_diskProvider.IsParent(localEpisode.Series.Path, localEpisode.Path))
|
||||
{
|
||||
_logger.Trace("Skipping free space check for existing episode");
|
||||
return true;
|
||||
}
|
||||
|
||||
var path = Directory.GetParent(localEpisode.Series.Path);
|
||||
var freeSpace = _diskProvider.GetAvailableSpace(path.FullName);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user