mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Unit Test Fixes
This commit is contained in:
@@ -18,6 +18,7 @@ namespace NzbDrone.Api.Config
|
|||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public string LogLevel { get; set; }
|
public string LogLevel { get; set; }
|
||||||
|
public string ConsoleLogLevel { get; set; }
|
||||||
public string Branch { get; set; }
|
public string Branch { get; set; }
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
public string SslCertHash { get; set; }
|
public string SslCertHash { get; set; }
|
||||||
@@ -55,6 +56,7 @@ namespace NzbDrone.Api.Config
|
|||||||
//Username
|
//Username
|
||||||
//Password
|
//Password
|
||||||
LogLevel = model.LogLevel,
|
LogLevel = model.LogLevel,
|
||||||
|
ConsoleLogLevel = model.ConsoleLogLevel,
|
||||||
Branch = model.Branch,
|
Branch = model.Branch,
|
||||||
ApiKey = model.ApiKey,
|
ApiKey = model.ApiKey,
|
||||||
SslCertHash = model.SslCertHash,
|
SslCertHash = model.SslCertHash,
|
||||||
|
@@ -21,10 +21,20 @@ namespace NzbDrone.Common.Test
|
|||||||
|
|
||||||
[TestCase("")]
|
[TestCase("")]
|
||||||
[TestCase("http://")]
|
[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));
|
Assert.Throws<ArgumentException>(() => Subject.DownloadString(url));
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
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.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("debug")]
|
||||||
|
|
||||||
[assembly: AssemblyCompany("radarr.video")]
|
[assembly: AssemblyCompany("radarr.video")]
|
||||||
[assembly: AssemblyProduct("Radarr")]
|
[assembly: AssemblyProduct("Radarr")]
|
||||||
[assembly: AssemblyVersion("10.0.0.*")]
|
[assembly: AssemblyVersion("10.0.0.*")]
|
||||||
|
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.IndexerTests.PTPTests
|
|||||||
Subject.Definition = new IndexerDefinition()
|
Subject.Definition = new IndexerDefinition()
|
||||||
{
|
{
|
||||||
Name = "PTP",
|
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.Cache;
|
|||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
using NzbDrone.Common.Instrumentation;
|
||||||
using NzbDrone.Core.Authentication;
|
using NzbDrone.Core.Authentication;
|
||||||
using NzbDrone.Core.Configuration.Events;
|
using NzbDrone.Core.Configuration.Events;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
@@ -32,6 +33,7 @@ namespace NzbDrone.Core.Configuration
|
|||||||
AuthenticationType AuthenticationMethod { get; }
|
AuthenticationType AuthenticationMethod { get; }
|
||||||
bool AnalyticsEnabled { get; }
|
bool AnalyticsEnabled { get; }
|
||||||
string LogLevel { get; }
|
string LogLevel { get; }
|
||||||
|
string ConsoleLogLevel { get; }
|
||||||
string Branch { get; }
|
string Branch { get; }
|
||||||
string ApiKey { get; }
|
string ApiKey { get; }
|
||||||
string SslCertHash { get; }
|
string SslCertHash { get; }
|
||||||
@@ -179,6 +181,7 @@ namespace NzbDrone.Core.Configuration
|
|||||||
public string Branch => GetValue("Branch", "develop").ToLowerInvariant();
|
public string Branch => GetValue("Branch", "develop").ToLowerInvariant();
|
||||||
|
|
||||||
public string LogLevel => GetValue("LogLevel", "Info");
|
public string LogLevel => GetValue("LogLevel", "Info");
|
||||||
|
public string ConsoleLogLevel => GetValue("ConsoleLogLevel", string.Empty, persist: false);
|
||||||
|
|
||||||
public string SslCertHash => GetValue("SslCertHash", "");
|
public string SslCertHash => GetValue("SslCertHash", "");
|
||||||
|
|
||||||
|
@@ -5,9 +5,7 @@ using Newtonsoft.Json;
|
|||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers.Exceptions;
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using System.Linq;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Cache;
|
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||||
|
@@ -2,10 +2,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Common.Cache;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Serializer;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
namespace NzbDrone.Core.Indexers.PassThePopcorn
|
||||||
{
|
{
|
||||||
@@ -45,19 +43,8 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
|
$"{Settings.BaseUrl.Trim().TrimEnd('/')}/torrents.php?action=advanced&json=noredirect&searchstr={searchParameters}",
|
||||||
HttpAccept.Json);
|
HttpAccept.Json);
|
||||||
|
|
||||||
if (Settings.APIKey.IsNullOrWhiteSpace())
|
request.HttpRequest.Headers["ApiUser"] = Settings.APIUser;
|
||||||
{
|
request.HttpRequest.Headers["ApiKey"] = Settings.APIKey;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings.APIKey.IsNullOrWhiteSpace())
|
if (Settings.APIKey.IsNullOrWhiteSpace())
|
||||||
{
|
{
|
||||||
@@ -71,49 +58,5 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
|
|
||||||
yield return request;
|
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 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
public PassThePopcornSettingsValidator()
|
public PassThePopcornSettingsValidator()
|
||||||
{
|
{
|
||||||
RuleFor(c => c.BaseUrl).ValidRootUrl();
|
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.APIUser).NotEmpty();
|
||||||
RuleFor(c => c.APIKey).NotEmpty();
|
RuleFor(c => c.APIKey).NotEmpty();
|
||||||
|
|
||||||
@@ -45,25 +42,16 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
|
|||||||
[FieldDefinition(2, Label = "APIKey", Type = FieldType.Password)]
|
[FieldDefinition(2, Label = "APIKey", Type = FieldType.Password)]
|
||||||
public string APIKey { get; set; }
|
public string APIKey { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(3, Label = "DEPRECATED: User", HelpText = "Please use APIKey & APIUser instead. PTP Username")]
|
// [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 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)]
|
|
||||||
public IEnumerable<int> MultiLanguages { get; set; }
|
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; }
|
public int MinimumSeeders { get; set; }
|
||||||
|
|
||||||
[FieldDefinition(8)]
|
[FieldDefinition(5)]
|
||||||
public SeedCriteriaSettings SeedCriteria { get; } = new SeedCriteriaSettings();
|
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 IEnumerable<int> RequiredFlags { get; set; }
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Configuration.Events;
|
using NzbDrone.Core.Configuration.Events;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
@@ -20,11 +21,19 @@ namespace NzbDrone.Core.Instrumentation
|
|||||||
public void Reconfigure()
|
public void Reconfigure()
|
||||||
{
|
{
|
||||||
var minimumLogLevel = LogLevel.FromString(_configFileProvider.LogLevel);
|
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;
|
var rules = LogManager.Configuration.LoggingRules;
|
||||||
|
|
||||||
//Console
|
//Console
|
||||||
SetMinimumLogLevel(rules, "consoleLogger", minimumLogLevel);
|
SetMinimumLogLevel(rules, "consoleLogger", minimumConsoleLogLevel);
|
||||||
|
|
||||||
//Log Files
|
//Log Files
|
||||||
SetMinimumLogLevel(rules, "appFileInfo", minimumLogLevel <= LogLevel.Info ? LogLevel.Info : LogLevel.Off);
|
SetMinimumLogLevel(rules, "appFileInfo", minimumLogLevel <= LogLevel.Info ? LogLevel.Info : LogLevel.Off);
|
||||||
|
@@ -50,7 +50,7 @@ namespace NzbDrone.Core.Update
|
|||||||
{
|
{
|
||||||
if (configFileProvider == null)
|
if (configFileProvider == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("configFileProvider");
|
throw new ArgumentNullException(nameof(configFileProvider));
|
||||||
}
|
}
|
||||||
_checkUpdateService = checkUpdateService;
|
_checkUpdateService = checkUpdateService;
|
||||||
_appFolderInfo = appFolderInfo;
|
_appFolderInfo = appFolderInfo;
|
||||||
@@ -87,6 +87,12 @@ namespace NzbDrone.Core.Update
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_appFolderInfo.StartUpFolder.EndsWith("_output"))
|
||||||
|
{
|
||||||
|
_logger.ProgressDebug("Running in developer environment, not updating.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var updateSandboxFolder = _appFolderInfo.GetUpdateSandboxFolder();
|
var updateSandboxFolder = _appFolderInfo.GetUpdateSandboxFolder();
|
||||||
|
|
||||||
var packageDestination = Path.Combine(updateSandboxFolder, updatePackage.FileName);
|
var packageDestination = Path.Combine(updateSandboxFolder, updatePackage.FileName);
|
||||||
@@ -148,7 +154,7 @@ namespace NzbDrone.Core.Update
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
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 @@ namespace NzbDrone.Core.Update
|
|||||||
{
|
{
|
||||||
var processId = _processProvider.GetCurrentProcess().Id.ToString();
|
var processId = _processProvider.GetCurrentProcess().Id.ToString();
|
||||||
var executingApplication = _runtimeInfo.ExecutingApplication;
|
var executingApplication = _runtimeInfo.ExecutingApplication;
|
||||||
var args = string.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes(), _startupContext.PreservedArguments);
|
|
||||||
_logger.Info("Updater Arguments: " + args);
|
return string.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes(), _startupContext.PreservedArguments);
|
||||||
return args;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnsureAppDataSafety()
|
private void EnsureAppDataSafety()
|
||||||
@@ -200,7 +205,7 @@ namespace NzbDrone.Core.Update
|
|||||||
|
|
||||||
if (latestAvailable == null)
|
if (latestAvailable == null)
|
||||||
{
|
{
|
||||||
_logger.ProgressDebug("No update available.");
|
_logger.ProgressDebug("No update available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +218,7 @@ namespace NzbDrone.Core.Update
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
InstallUpdate(latestAvailable);
|
InstallUpdate(latestAvailable);
|
||||||
|
_logger.ProgressDebug("Restarting Radarr to apply updates");
|
||||||
}
|
}
|
||||||
catch (UpdateFolderNotWritableException ex)
|
catch (UpdateFolderNotWritableException ex)
|
||||||
{
|
{
|
||||||
|
@@ -13,6 +13,7 @@ namespace NzbDrone.Core.Update
|
|||||||
private readonly IUpdatePackageProvider _updatePackageProvider;
|
private readonly IUpdatePackageProvider _updatePackageProvider;
|
||||||
private readonly IConfigFileProvider _configFileProvider;
|
private readonly IConfigFileProvider _configFileProvider;
|
||||||
|
|
||||||
|
|
||||||
public CheckUpdateService(IUpdatePackageProvider updatePackageProvider,
|
public CheckUpdateService(IUpdatePackageProvider updatePackageProvider,
|
||||||
IConfigFileProvider configFileProvider)
|
IConfigFileProvider configFileProvider)
|
||||||
{
|
{
|
||||||
|
@@ -5,7 +5,6 @@ using NzbDrone.Api.Commands;
|
|||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
[Ignore("Not ready to be used on this branch")]
|
|
||||||
public class CommandFixture : IntegrationTest
|
public class CommandFixture : IntegrationTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
|
@@ -3,41 +3,11 @@ using FluentAssertions;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
|
|
||||||
namespace NzbDrone.Integration.Test.ApiTests
|
namespace NzbDrone.Integration.Test.ApiTests.WantedTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[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)]
|
[Test, Order(1)]
|
||||||
public void cutoff_should_have_monitored_items()
|
public void cutoff_should_have_monitored_items()
|
||||||
{
|
{
|
||||||
@@ -45,21 +15,11 @@ namespace NzbDrone.Integration.Test.ApiTests
|
|||||||
var movie = EnsureMovie(680, "Pulp Fiction", true);
|
var movie = EnsureMovie(680, "Pulp Fiction", true);
|
||||||
EnsureMovieFile(movie, Quality.SDTV);
|
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();
|
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)]
|
[Test, Order(1)]
|
||||||
public void cutoff_should_not_have_unmonitored_items()
|
public void cutoff_should_not_have_unmonitored_items()
|
||||||
{
|
{
|
||||||
@@ -67,7 +27,19 @@ namespace NzbDrone.Integration.Test.ApiTests
|
|||||||
var movie = EnsureMovie(680, "Pulp Fiction", false);
|
var movie = EnsureMovie(680, "Pulp Fiction", false);
|
||||||
EnsureMovieFile(movie, Quality.SDTV);
|
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();
|
result.Records.Should().BeEmpty();
|
||||||
}
|
}
|
||||||
@@ -84,16 +56,6 @@ namespace NzbDrone.Integration.Test.ApiTests
|
|||||||
result.Records.First().Title.Should().Be("Pulp Fiction");
|
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)]
|
[Test, Order(2)]
|
||||||
public void cutoff_should_have_unmonitored_items()
|
public void cutoff_should_have_unmonitored_items()
|
||||||
{
|
{
|
||||||
@@ -105,5 +67,17 @@ namespace NzbDrone.Integration.Test.ApiTests
|
|||||||
|
|
||||||
result.Records.Should().NotBeEmpty();
|
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 @@ namespace NzbDrone.Integration.Test.Client
|
|||||||
|
|
||||||
private static void AssertDisableCache(IList<Parameter> headers)
|
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 == "Pragma").Value.Should().Be("no-cache");
|
||||||
headers.Single(c => c.Name == "Expires").Value.Should().Be("0");
|
headers.Single(c => c.Name == "Expires").Value.Should().Be("0");
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,11 @@ namespace NzbDrone.Integration.Test
|
|||||||
Protocol = Core.Indexers.DownloadProtocol.Usenet,
|
Protocol = Core.Indexers.DownloadProtocol.Usenet,
|
||||||
Fields = SchemaBuilder.ToSchema(new NewznabSettings())
|
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()
|
protected override void StopTestTarget()
|
||||||
|
@@ -238,6 +238,8 @@ namespace NzbDrone.Integration.Test
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Commands.WaitAll();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,9 +259,13 @@ namespace NzbDrone.Integration.Test
|
|||||||
|
|
||||||
if (result.MovieFile == null)
|
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));
|
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");
|
File.WriteAllText(path, "Fake Movie");
|
||||||
|
|
||||||
Commands.PostAndWait(new CommandResource { Name = "refreshmovie", Body = new RefreshMovieCommand(movie.Id) });
|
Commands.PostAndWait(new CommandResource { Name = "refreshmovie", Body = new RefreshMovieCommand(movie.Id) });
|
||||||
|
@@ -107,7 +107,8 @@
|
|||||||
<Compile Include="ApiTests\MovieFileFixture.cs" />
|
<Compile Include="ApiTests\MovieFileFixture.cs" />
|
||||||
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
<Compile Include="ApiTests\FileSystemFixture.cs" />
|
||||||
<Compile Include="ApiTests\MovieLookupFixture.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\ClientBase.cs" />
|
||||||
<Compile Include="Client\IndexerClient.cs" />
|
<Compile Include="Client\IndexerClient.cs" />
|
||||||
<Compile Include="Client\DownloadClientClient.cs" />
|
<Compile Include="Client\DownloadClientClient.cs" />
|
||||||
|
@@ -19,6 +19,7 @@ namespace Radarr.Api.V2.Config
|
|||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public string LogLevel { get; set; }
|
public string LogLevel { get; set; }
|
||||||
|
public string ConsoleLogLevel { get; set; }
|
||||||
public string Branch { get; set; }
|
public string Branch { get; set; }
|
||||||
public string ApiKey { get; set; }
|
public string ApiKey { get; set; }
|
||||||
public string SslCertHash { get; set; }
|
public string SslCertHash { get; set; }
|
||||||
@@ -57,6 +58,7 @@ namespace Radarr.Api.V2.Config
|
|||||||
//Username
|
//Username
|
||||||
//Password
|
//Password
|
||||||
LogLevel = model.LogLevel,
|
LogLevel = model.LogLevel,
|
||||||
|
ConsoleLogLevel = model.ConsoleLogLevel,
|
||||||
Branch = model.Branch,
|
Branch = model.Branch,
|
||||||
ApiKey = model.ApiKey,
|
ApiKey = model.ApiKey,
|
||||||
SslCertHash = model.SslCertHash,
|
SslCertHash = model.SslCertHash,
|
||||||
|
Reference in New Issue
Block a user