mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Fixed: Unit Test Fixes
This commit is contained in:
parent
3bf5476922
commit
242d530bb4
@ -18,6 +18,7 @@ public class HostConfigResource : RestResource
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string LogLevel { get; set; }
|
||||
public string ConsoleLogLevel { get; set; }
|
||||
public string Branch { get; set; }
|
||||
public string ApiKey { get; set; }
|
||||
public string SslCertHash { get; set; }
|
||||
@ -55,6 +56,7 @@ public static HostConfigResource ToResource(this IConfigFileProvider model, ICon
|
||||
//Username
|
||||
//Password
|
||||
LogLevel = model.LogLevel,
|
||||
ConsoleLogLevel = model.ConsoleLogLevel,
|
||||
Branch = model.Branch,
|
||||
ApiKey = model.ApiKey,
|
||||
SslCertHash = model.SslCertHash,
|
||||
|
@ -21,10 +21,20 @@ public void DownloadString_should_be_able_to_dowload_text_file()
|
||||
|
||||
[TestCase("")]
|
||||
[TestCase("http://")]
|
||||
public void DownloadString_should_throw_on_error(string url)
|
||||
public void DownloadString_should_throw_on_error_windows(string url)
|
||||
{
|
||||
WindowsOnly();
|
||||
Assert.Throws<ArgumentException>(() => Subject.DownloadString(url));
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
|
||||
[TestCase("http://")]
|
||||
public void DownloadString_should_throw_on_not_supported_string_mono(string url)
|
||||
{
|
||||
MonoOnly();
|
||||
Assert.Throws<System.Net.WebException>(() => Subject.DownloadString(url));
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyConfiguration("debug")]
|
||||
|
||||
[assembly: AssemblyCompany("radarr.video")]
|
||||
[assembly: AssemblyProduct("Radarr")]
|
||||
[assembly: AssemblyVersion("10.0.0.*")]
|
||||
|
@ -23,7 +23,7 @@ public void Setup()
|
||||
Subject.Definition = new IndexerDefinition()
|
||||
{
|
||||
Name = "PTP",
|
||||
Settings = new PassThePopcornSettings() { Passkey = "fakekey", Username = "asdf", Password = "sad" }
|
||||
Settings = new PassThePopcornSettings() { APIUser = "asdf", APIKey = "sad" }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
using NzbDrone.Core.Authentication;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
@ -32,6 +33,7 @@ public interface IConfigFileProvider : IHandleAsync<ApplicationStartedEvent>,
|
||||
AuthenticationType AuthenticationMethod { get; }
|
||||
bool AnalyticsEnabled { get; }
|
||||
string LogLevel { get; }
|
||||
string ConsoleLogLevel { get; }
|
||||
string Branch { get; }
|
||||
string ApiKey { get; }
|
||||
string SslCertHash { get; }
|
||||
@ -179,6 +181,7 @@ public AuthenticationType AuthenticationMethod
|
||||
public string Branch => GetValue("Branch", "develop").ToLowerInvariant();
|
||||
|
||||
public string LogLevel => GetValue("LogLevel", "Info");
|
||||
public string ConsoleLogLevel => GetValue("ConsoleLogLevel", string.Empty, persist: false);
|
||||
|
||||
public string SslCertHash => GetValue("SslCertHash", "");
|
||||
|
||||
|
@ -5,9 +5,7 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers.Exceptions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
|
@ -2,10 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||
{
|
||||
@ -44,20 +42,9 @@ private IEnumerable<IndexerRequest> GetRequest(string searchParameters)
|
||||
new IndexerRequest(
|
||||
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
|
||||
HttpAccept.Json);
|
||||
|
||||
if (Settings.APIKey.IsNullOrWhiteSpace())
|
||||
{
|
||||
Cookies = GetCookies();
|
||||
|
||||
Authenticate();
|
||||
|
||||
Logger.Warn("You are using the old method of logging into PassThePopcorn. Please switch to the new method using APIUser & APIKey.");
|
||||
}
|
||||
else
|
||||
{
|
||||
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
|
||||
request.HttpRequest.Headers["ApiKey"] = Settings.APIKey;
|
||||
}
|
||||
|
||||
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
|
||||
request.HttpRequest.Headers["ApiKey"] = Settings.APIKey;
|
||||
|
||||
if (Settings.APIKey.IsNullOrWhiteSpace())
|
||||
{
|
||||
@ -71,49 +58,5 @@ private IEnumerable<IndexerRequest> GetRequest(string searchParameters)
|
||||
|
||||
yield return request;
|
||||
}
|
||||
|
||||
private void Authenticate()
|
||||
{
|
||||
if (Cookies == null)
|
||||
{
|
||||
var requestBuilder = new HttpRequestBuilder($"{Settings.BaseUrl.Trim().TrimEnd('/')}")
|
||||
{
|
||||
LogResponseContent = true
|
||||
};
|
||||
|
||||
requestBuilder.Method = HttpMethod.POST;
|
||||
requestBuilder.Resource("ajax.php?action=login");
|
||||
requestBuilder.PostProcess += r => r.RequestTimeout = TimeSpan.FromSeconds(15);
|
||||
|
||||
var authLoginRequest = requestBuilder
|
||||
.AddFormParameter("username", Settings.Username)
|
||||
.AddFormParameter("password", Settings.Password)
|
||||
.AddFormParameter("passkey", Settings.Passkey)
|
||||
.AddFormParameter("keeplogged", "1")
|
||||
.SetHeader("Content-Type", "multipart/form-data")
|
||||
.Accept(HttpAccept.Json)
|
||||
.Build();
|
||||
|
||||
authLoginRequest.AllowAutoRedirect = true;
|
||||
// We want clean cookies for the auth request.
|
||||
authLoginRequest.StoreRequestCookie = false;
|
||||
authLoginRequest.StoreResponseCookie = false;
|
||||
authLoginRequest.Cookies.Clear();
|
||||
authLoginRequest.IgnorePersistentCookies = true;
|
||||
var response = HttpClient.Execute(authLoginRequest);
|
||||
var result = Json.Deserialize<PassThePopcornAuthResponse>(response.Content);
|
||||
|
||||
if (result?.Result != "Ok" || string.IsNullOrWhiteSpace(result.Result))
|
||||
{
|
||||
Logger.Debug("PassThePopcorn authentication failed.");
|
||||
throw new Exception("Failed to authenticate with PassThePopcorn.");
|
||||
}
|
||||
|
||||
Logger.Debug("PassThePopcorn authentication succeeded.");
|
||||
|
||||
Cookies = response.GetCookies();
|
||||
requestBuilder.SetCookies(Cookies);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,6 @@ public class PassThePopcornSettingsValidator : AbstractValidator<PassThePopcornS
|
||||
public PassThePopcornSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
||||
RuleFor(c => c.Username).Empty();
|
||||
RuleFor(c => c.Password).Empty();
|
||||
RuleFor(c => c.Passkey).Empty();
|
||||
RuleFor(c => c.APIUser).NotEmpty();
|
||||
RuleFor(c => c.APIKey).NotEmpty();
|
||||
|
||||
@ -44,26 +41,17 @@ public PassThePopcornSettings()
|
||||
|
||||
[FieldDefinition(2, Label = "APIKey", Type = FieldType.Password)]
|
||||
public string APIKey { get; set; }
|
||||
|
||||
[FieldDefinition(3, Label = "DEPRECATED: User", HelpText = "Please use APIKey & APIUser instead. PTP Username")]
|
||||
public string Username { get; set; }
|
||||
|
||||
[FieldDefinition(4, Label = "DEPRECATED: Pass", Type = FieldType.Password, HelpText = "Please use APIKey & APIUser instead. PTP Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[FieldDefinition(5, Label = "DEPRECATED: Passkey", HelpText = "Please use APIKey & APIUser instead. PTP Passkey")]
|
||||
public string Passkey { get; set; }
|
||||
|
||||
// [FieldDefinition(6, Type = FieldType.Tag, SelectOptions = typeof(Language), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||
// [FieldDefinition(3, Type = FieldType.Tag, SelectOptions = typeof(Language), Label = "Multi Languages", HelpText = "What languages are normally in a multi release on this indexer?", Advanced = true)]
|
||||
public IEnumerable<int> MultiLanguages { get; set; }
|
||||
|
||||
[FieldDefinition(7, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
||||
[FieldDefinition(4, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)]
|
||||
public int MinimumSeeders { get; set; }
|
||||
|
||||
[FieldDefinition(8)]
|
||||
[FieldDefinition(5)]
|
||||
public SeedCriteriaSettings SeedCriteria { get; } = new SeedCriteriaSettings();
|
||||
|
||||
[FieldDefinition(9, Type = FieldType.Tag, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Radarr/Radarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
||||
[FieldDefinition(6, Type = FieldType.Tag, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://github.com/Radarr/Radarr/wiki/Indexer-Flags#1-required-flags", Advanced = true)]
|
||||
public IEnumerable<int> RequiredFlags { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
@ -20,11 +21,19 @@ public ReconfigureLogging(IConfigFileProvider configFileProvider)
|
||||
public void Reconfigure()
|
||||
{
|
||||
var minimumLogLevel = LogLevel.FromString(_configFileProvider.LogLevel);
|
||||
LogLevel minimumConsoleLogLevel;
|
||||
|
||||
if (_configFileProvider.ConsoleLogLevel.IsNotNullOrWhiteSpace())
|
||||
minimumConsoleLogLevel = LogLevel.FromString(_configFileProvider.ConsoleLogLevel);
|
||||
else if (minimumLogLevel > LogLevel.Info)
|
||||
minimumConsoleLogLevel = minimumLogLevel;
|
||||
else
|
||||
minimumConsoleLogLevel = LogLevel.Info;
|
||||
|
||||
var rules = LogManager.Configuration.LoggingRules;
|
||||
|
||||
//Console
|
||||
SetMinimumLogLevel(rules, "consoleLogger", minimumLogLevel);
|
||||
SetMinimumLogLevel(rules, "consoleLogger", minimumConsoleLogLevel);
|
||||
|
||||
//Log Files
|
||||
SetMinimumLogLevel(rules, "appFileInfo", minimumLogLevel <= LogLevel.Info ? LogLevel.Info : LogLevel.Off);
|
||||
|
@ -50,7 +50,7 @@ public InstallUpdateService(ICheckUpdateService checkUpdateService,
|
||||
{
|
||||
if (configFileProvider == null)
|
||||
{
|
||||
throw new ArgumentNullException("configFileProvider");
|
||||
throw new ArgumentNullException(nameof(configFileProvider));
|
||||
}
|
||||
_checkUpdateService = checkUpdateService;
|
||||
_appFolderInfo = appFolderInfo;
|
||||
@ -87,6 +87,12 @@ private void InstallUpdate(UpdatePackage updatePackage)
|
||||
}
|
||||
}
|
||||
|
||||
if (_appFolderInfo.StartUpFolder.EndsWith("_output"))
|
||||
{
|
||||
_logger.ProgressDebug("Running in developer environment, not updating.");
|
||||
return;
|
||||
}
|
||||
|
||||
var updateSandboxFolder = _appFolderInfo.GetUpdateSandboxFolder();
|
||||
|
||||
var packageDestination = Path.Combine(updateSandboxFolder, updatePackage.FileName);
|
||||
@ -148,7 +154,7 @@ private void EnsureValidBranch(UpdatePackage package)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Error(e, string.Format("Couldn't change the branch from [{0}] to [{1}].", currentBranch, package.Branch));
|
||||
_logger.Error(e, "Couldn't change the branch from [{0}] to [{1}].", currentBranch, package.Branch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,9 +184,8 @@ private string GetUpdaterArgs(string updateSandboxFolder)
|
||||
{
|
||||
var processId = _processProvider.GetCurrentProcess().Id.ToString();
|
||||
var executingApplication = _runtimeInfo.ExecutingApplication;
|
||||
var args = string.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes(), _startupContext.PreservedArguments);
|
||||
_logger.Info("Updater Arguments: " + args);
|
||||
return args;
|
||||
|
||||
return string.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes(), _startupContext.PreservedArguments);
|
||||
}
|
||||
|
||||
private void EnsureAppDataSafety()
|
||||
@ -200,7 +205,7 @@ public void Execute(ApplicationUpdateCommand message)
|
||||
|
||||
if (latestAvailable == null)
|
||||
{
|
||||
_logger.ProgressDebug("No update available.");
|
||||
_logger.ProgressDebug("No update available");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -213,6 +218,7 @@ public void Execute(ApplicationUpdateCommand message)
|
||||
try
|
||||
{
|
||||
InstallUpdate(latestAvailable);
|
||||
_logger.ProgressDebug("Restarting Radarr to apply updates");
|
||||
}
|
||||
catch (UpdateFolderNotWritableException ex)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ public class CheckUpdateService : ICheckUpdateService
|
||||
private readonly IUpdatePackageProvider _updatePackageProvider;
|
||||
private readonly IConfigFileProvider _configFileProvider;
|
||||
|
||||
|
||||
public CheckUpdateService(IUpdatePackageProvider updatePackageProvider,
|
||||
IConfigFileProvider configFileProvider)
|
||||
{
|
||||
@ -25,4 +26,4 @@ public UpdatePackage AvailableUpdate()
|
||||
return _updatePackageProvider.GetLatestUpdate(_configFileProvider.Branch, BuildInfo.Version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
{
|
||||
[TestFixture]
|
||||
[Ignore("Not ready to be used on this branch")]
|
||||
public class CommandFixture : IntegrationTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -3,41 +3,11 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests
|
||||
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class WantedFixture : IntegrationTest
|
||||
public class CutoffUnmetFixture : IntegrationTest
|
||||
{
|
||||
[Test, Order(0)]
|
||||
public void missing_should_be_empty()
|
||||
{
|
||||
EnsureNoMovie(680, "Pulp Fiction");
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_monitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_movie()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_have_monitored_items()
|
||||
{
|
||||
@ -45,21 +15,11 @@ public void cutoff_should_have_monitored_items()
|
||||
var movie = EnsureMovie(680, "Pulp Fiction", true);
|
||||
EnsureMovieFile(movie, Quality.SDTV);
|
||||
|
||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "true");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_not_have_unmonitored_items()
|
||||
{
|
||||
@ -67,7 +27,19 @@ public void cutoff_should_not_have_unmonitored_items()
|
||||
var movie = EnsureMovie(680, "Pulp Fiction", false);
|
||||
EnsureMovieFile(movie, Quality.SDTV);
|
||||
|
||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "true");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void cutoff_should_not_have_released_items()
|
||||
{
|
||||
EnsureProfileCutoff(1, Quality.HDTV720p);
|
||||
var movie = EnsureMovie(680, "Pulp Fiction", true);
|
||||
EnsureMovieFile(movie, Quality.SDTV);
|
||||
|
||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc", "status", "inCinemas");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
@ -84,16 +56,6 @@ public void cutoff_should_have_movie()
|
||||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "false");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void cutoff_should_have_unmonitored_items()
|
||||
{
|
||||
@ -105,5 +67,17 @@ public void cutoff_should_have_unmonitored_items()
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void cutoff_should_have_released_items()
|
||||
{
|
||||
EnsureProfileCutoff(1, Quality.HDTV720p);
|
||||
var movie = EnsureMovie(680, "Pulp Fiction", false);
|
||||
EnsureMovieFile(movie, Quality.SDTV);
|
||||
|
||||
var result = WantedCutoffUnmet.GetPaged(0, 15, "physicalRelease", "desc", "status", "released");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MissingFixture : IntegrationTest
|
||||
{
|
||||
[Test, Order(0)]
|
||||
public void missing_should_be_empty()
|
||||
{
|
||||
EnsureNoMovie(680, "Pulp Fiction");
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_monitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "true");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_have_movie()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", true);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc");
|
||||
|
||||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "true");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(1)]
|
||||
public void missing_should_not_have_released_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "status", "inCinemas");
|
||||
|
||||
result.Records.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_unmonitored_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "monitored", "false");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test, Order(2)]
|
||||
public void missing_should_have_released_items()
|
||||
{
|
||||
EnsureMovie(680, "Pulp Fiction", false);
|
||||
|
||||
var result = WantedMissing.GetPaged(0, 15, "physicalRelease", "desc", "status", "released");
|
||||
|
||||
result.Records.Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
@ -63,7 +63,7 @@ public RestRequest BuildRequest(string command = "")
|
||||
|
||||
private static void AssertDisableCache(IList<Parameter> headers)
|
||||
{
|
||||
headers.Single(c => c.Name == "Cache-Control").Value.Should().Be("no-cache, no-store, must-revalidate");
|
||||
headers.Single(c => c.Name == "Cache-Control").Value.Should().Be("no-cache, no-store, must-revalidate, max-age=0");
|
||||
headers.Single(c => c.Name == "Pragma").Value.Should().Be("no-cache");
|
||||
headers.Single(c => c.Name == "Expires").Value.Should().Be("0");
|
||||
}
|
||||
|
@ -36,6 +36,11 @@ protected override void InitializeTestTarget()
|
||||
Protocol = Core.Indexers.DownloadProtocol.Usenet,
|
||||
Fields = SchemaBuilder.ToSchema(new NewznabSettings())
|
||||
});
|
||||
|
||||
// Change Console Log Level to Debug so we get more details.
|
||||
var config = HostConfig.Get(1);
|
||||
config.ConsoleLogLevel = "Debug";
|
||||
HostConfig.Put(config);
|
||||
}
|
||||
|
||||
protected override void StopTestTarget()
|
||||
|
@ -238,6 +238,8 @@ public MovieResource EnsureMovie(int tmdbid, string movieTitle, bool? monitored
|
||||
}
|
||||
}
|
||||
|
||||
Commands.WaitAll();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -257,9 +259,13 @@ public MovieFileResource EnsureMovieFile(MovieResource movie, Quality quality)
|
||||
|
||||
if (result.MovieFile == null)
|
||||
{
|
||||
var path = Path.Combine(MovieRootFolder, movie.Title, string.Format("{0} - {1}.mkv", movie.Title, quality.Name));
|
||||
var path = Path.Combine(MovieRootFolder, movie.Title, string.Format("{0} ({1}) - {2}.strm", movie.Title, movie.Year, quality.Name));
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
var sourcePath = Path.Combine(TestContext.CurrentContext.TestDirectory, "ApiTests", "Files", "H264_sample.mp4");
|
||||
|
||||
//File.Copy(sourcePath, path);
|
||||
File.WriteAllText(path, "Fake Movie");
|
||||
|
||||
Commands.PostAndWait(new CommandResource { Name = "refreshmovie", Body = new RefreshMovieCommand(movie.Id) });
|
||||
|
@ -107,7 +107,8 @@
|
||||
<Compile Include="ApiTests\MovieFileFixture.cs" />
|
||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||
<Compile Include="ApiTests\MovieLookupFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedTests\CutoffUnmetFixture.cs" />
|
||||
<Compile Include="ApiTests\WantedTests\MissingFixture.cs" />
|
||||
<Compile Include="Client\ClientBase.cs" />
|
||||
<Compile Include="Client\IndexerClient.cs" />
|
||||
<Compile Include="Client\DownloadClientClient.cs" />
|
||||
|
@ -19,6 +19,7 @@ public class HostConfigResource : RestResource
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string LogLevel { get; set; }
|
||||
public string ConsoleLogLevel { get; set; }
|
||||
public string Branch { get; set; }
|
||||
public string ApiKey { get; set; }
|
||||
public string SslCertHash { get; set; }
|
||||
@ -57,6 +58,7 @@ public static HostConfigResource ToResource(this IConfigFileProvider model, ICon
|
||||
//Username
|
||||
//Password
|
||||
LogLevel = model.LogLevel,
|
||||
ConsoleLogLevel = model.ConsoleLogLevel,
|
||||
Branch = model.Branch,
|
||||
ApiKey = model.ApiKey,
|
||||
SslCertHash = model.SslCertHash,
|
||||
|
Loading…
Reference in New Issue
Block a user