mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-22 22:15:17 -04:00
Bug fixes (#874)
* Update Torrent and Usenet DownloadStation * Update Download Tests * Fix TorrentPotato not finding results #754 * Update UpdateMediaInfoService and Tests #572 * Ignore plex otimized versions w/ tests #391 * Remove Xem Serivce files and tests #386 * Ignore TV Episode from IMDb lists
This commit is contained in:
@@ -16,12 +16,12 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
|
||||
[TestFixture]
|
||||
public class UpdateMediaInfoServiceFixture : CoreTest<UpdateMediaInfoService>
|
||||
{
|
||||
private Series _series;
|
||||
private Movie _series;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_series = new Series
|
||||
_series = new Movie
|
||||
{
|
||||
Id = 1,
|
||||
Path = @"C:\series".AsOsAgnostic()
|
||||
@@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
|
||||
[Test]
|
||||
public void should_skip_up_to_date_media_info()
|
||||
{
|
||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(3)
|
||||
var episodeFiles = Builder<MovieFile>.CreateListOfSize(3)
|
||||
.All()
|
||||
.With(v => v.RelativePath = "media.mkv")
|
||||
.TheFirst(1)
|
||||
@@ -64,25 +64,25 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
|
||||
.BuildList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(v => v.GetFilesBySeries(1))
|
||||
.Setup(v => v.GetFilesByMovie(1))
|
||||
.Returns(episodeFiles);
|
||||
|
||||
GivenFileExists();
|
||||
GivenSuccessfulScan();
|
||||
|
||||
Subject.Handle(new SeriesScannedEvent(_series));
|
||||
Subject.Handle(new MovieScannedEvent(_series));
|
||||
|
||||
Mocker.GetMock<IVideoFileInfoReader>()
|
||||
.Verify(v => v.GetMediaInfo(Path.Combine(_series.Path, "media.mkv")), Times.Exactly(2));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Exactly(2));
|
||||
.Verify(v => v.Update(It.IsAny<MovieFile>()), Times.Exactly(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_update_outdated_media_info()
|
||||
{
|
||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(3)
|
||||
var episodeFiles = Builder<MovieFile>.CreateListOfSize(3)
|
||||
.All()
|
||||
.With(v => v.RelativePath = "media.mkv")
|
||||
.TheFirst(1)
|
||||
@@ -90,48 +90,48 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
|
||||
.BuildList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(v => v.GetFilesBySeries(1))
|
||||
.Setup(v => v.GetFilesByMovie(1))
|
||||
.Returns(episodeFiles);
|
||||
|
||||
GivenFileExists();
|
||||
GivenSuccessfulScan();
|
||||
|
||||
Subject.Handle(new SeriesScannedEvent(_series));
|
||||
Subject.Handle(new MovieScannedEvent(_series));
|
||||
|
||||
Mocker.GetMock<IVideoFileInfoReader>()
|
||||
.Verify(v => v.GetMediaInfo(Path.Combine(_series.Path, "media.mkv")), Times.Exactly(3));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Exactly(3));
|
||||
.Verify(v => v.Update(It.IsAny<MovieFile>()), Times.Exactly(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_ignore_missing_files()
|
||||
{
|
||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
||||
var episodeFiles = Builder<MovieFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(v => v.RelativePath = "media.mkv")
|
||||
.BuildList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(v => v.GetFilesBySeries(1))
|
||||
.Setup(v => v.GetFilesByMovie(1))
|
||||
.Returns(episodeFiles);
|
||||
|
||||
GivenSuccessfulScan();
|
||||
|
||||
Subject.Handle(new SeriesScannedEvent(_series));
|
||||
Subject.Handle(new MovieScannedEvent(_series));
|
||||
|
||||
Mocker.GetMock<IVideoFileInfoReader>()
|
||||
.Verify(v => v.GetMediaInfo("media.mkv"), Times.Never());
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Never());
|
||||
.Verify(v => v.Update(It.IsAny<MovieFile>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_continue_after_failure()
|
||||
{
|
||||
var episodeFiles = Builder<EpisodeFile>.CreateListOfSize(2)
|
||||
var episodeFiles = Builder<MovieFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(v => v.RelativePath = "media.mkv")
|
||||
.TheFirst(1)
|
||||
@@ -139,20 +139,20 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaInfo
|
||||
.BuildList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(v => v.GetFilesBySeries(1))
|
||||
.Setup(v => v.GetFilesByMovie(1))
|
||||
.Returns(episodeFiles);
|
||||
|
||||
GivenFileExists();
|
||||
GivenSuccessfulScan();
|
||||
GivenFailedScan(Path.Combine(_series.Path, "media2.mkv"));
|
||||
|
||||
Subject.Handle(new SeriesScannedEvent(_series));
|
||||
Subject.Handle(new MovieScannedEvent(_series));
|
||||
|
||||
Mocker.GetMock<IVideoFileInfoReader>()
|
||||
.Verify(v => v.GetMediaInfo(Path.Combine(_series.Path, "media.mkv")), Times.Exactly(1));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Update(It.IsAny<EpisodeFile>()), Times.Exactly(1));
|
||||
.Verify(v => v.Update(It.IsAny<MovieFile>()), Times.Exactly(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user