|
|
|
@ -11,101 +11,6 @@ namespace Recyclarr.Cli.Tests.Pipelines.QualityProfile.PipelinePhases;
|
|
|
|
|
[Parallelizable(ParallelScope.All)]
|
|
|
|
|
public class QualityProfileConfigPhaseTest
|
|
|
|
|
{
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void Reset_unmatched_scores_promoted_to_quality_profiles_property_when_no_quality_profiles_in_config(
|
|
|
|
|
QualityProfileConfigPhase sut)
|
|
|
|
|
{
|
|
|
|
|
var config = new RadarrConfiguration
|
|
|
|
|
{
|
|
|
|
|
CustomFormats = new List<CustomFormatConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
QualityProfiles = new List<QualityProfileScoreConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Name = "test_profile",
|
|
|
|
|
ResetUnmatchedScores = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sut.Execute(config);
|
|
|
|
|
|
|
|
|
|
config.QualityProfiles.Should().BeEquivalentTo(new QualityProfileConfig[]
|
|
|
|
|
{
|
|
|
|
|
new() {Name = "test_profile", ResetUnmatchedScores = true}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void Reset_unmatched_scores_promoted_to_quality_profiles_property_when_quality_profile_in_config(
|
|
|
|
|
QualityProfileConfigPhase sut)
|
|
|
|
|
{
|
|
|
|
|
var config = new RadarrConfiguration
|
|
|
|
|
{
|
|
|
|
|
QualityProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new QualityProfileConfig
|
|
|
|
|
{
|
|
|
|
|
Name = "test_profile",
|
|
|
|
|
ResetUnmatchedScores = null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
CustomFormats = new List<CustomFormatConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
QualityProfiles = new List<QualityProfileScoreConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Name = "test_profile",
|
|
|
|
|
ResetUnmatchedScores = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sut.Execute(config);
|
|
|
|
|
|
|
|
|
|
config.QualityProfiles.Should().BeEquivalentTo(new QualityProfileConfig[]
|
|
|
|
|
{
|
|
|
|
|
new() {Name = "test_profile", ResetUnmatchedScores = true}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void Reset_unmatched_scores_not_promoted_to_quality_profiles_property_when_false(
|
|
|
|
|
QualityProfileConfigPhase sut)
|
|
|
|
|
{
|
|
|
|
|
var config = new RadarrConfiguration
|
|
|
|
|
{
|
|
|
|
|
CustomFormats = new List<CustomFormatConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
QualityProfiles = new List<QualityProfileScoreConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Name = "test_profile",
|
|
|
|
|
ResetUnmatchedScores = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sut.Execute(config);
|
|
|
|
|
|
|
|
|
|
config.QualityProfiles.Should().BeEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static RadarrConfiguration SetupCfs(params CustomFormatConfig[] cfConfigs)
|
|
|
|
|
{
|
|
|
|
|
return new RadarrConfiguration
|
|
|
|
@ -262,49 +167,4 @@ public class QualityProfileConfigPhaseTest
|
|
|
|
|
NewQp.Processed("test_profile2", (1, 200))
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test, AutoMockData]
|
|
|
|
|
public void Use_existing_config_quality_profile_when_specified(
|
|
|
|
|
[Frozen] ProcessedCustomFormatCache cache,
|
|
|
|
|
QualityProfileConfigPhase sut)
|
|
|
|
|
{
|
|
|
|
|
cache.AddCustomFormats(new[]
|
|
|
|
|
{
|
|
|
|
|
NewCf.DataWithScore("", "id1", 100, 1)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var config = new RadarrConfiguration
|
|
|
|
|
{
|
|
|
|
|
QualityProfiles = new[]
|
|
|
|
|
{
|
|
|
|
|
new QualityProfileConfig
|
|
|
|
|
{
|
|
|
|
|
Name = "test_profile",
|
|
|
|
|
ResetUnmatchedScores = true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
CustomFormats = new List<CustomFormatConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
TrashIds = new[] {"id1"},
|
|
|
|
|
QualityProfiles = new List<QualityProfileScoreConfig>
|
|
|
|
|
{
|
|
|
|
|
new()
|
|
|
|
|
{
|
|
|
|
|
Name = "test_profile",
|
|
|
|
|
ResetUnmatchedScores = false // Should be ignored because top-level QP has it set already
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sut.Execute(config);
|
|
|
|
|
|
|
|
|
|
config.QualityProfiles.Should().BeEquivalentTo(new QualityProfileConfig[]
|
|
|
|
|
{
|
|
|
|
|
new() {Name = "test_profile", ResetUnmatchedScores = true}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|