mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Added some tests and fixed the issue where the DB would get created in the wrong place depending on how you launched the application
This commit is contained in:
parent
1f9ed51320
commit
e2aa4016a8
8 changed files with 221 additions and 35 deletions
|
@ -53,7 +53,7 @@ namespace PlexRequests.Services
|
|||
private ISettingsService<AuthenticationSettings> Auth { get; }
|
||||
private IRequestService RequestService { get; }
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private IPlexApi PlexApi { get; set; }
|
||||
private IPlexApi PlexApi { get; }
|
||||
|
||||
|
||||
public void CheckAndUpdateAll(long check)
|
||||
|
@ -63,7 +63,7 @@ namespace PlexRequests.Services
|
|||
var requests = RequestService.GetAll();
|
||||
|
||||
var requestedModels = requests as RequestedModel[] ?? requests.ToArray();
|
||||
if (!ValidateSettings(plexSettings, authSettings, requestedModels))
|
||||
if (!ValidateSettings(plexSettings, authSettings) || !requestedModels.Any())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -114,21 +114,6 @@ namespace PlexRequests.Services
|
|||
|
||||
}
|
||||
|
||||
private bool ValidateSettings(PlexSettings plex, AuthenticationSettings auth, IEnumerable<RequestedModel> requests)
|
||||
{
|
||||
if (plex.Ip == null || auth.PlexAuthToken == null || requests == null)
|
||||
{
|
||||
Log.Warn("A setting is null, Ensure Plex is configured correctly, and we have a Plex Auth token.");
|
||||
return false;
|
||||
}
|
||||
if (!requests.Any())
|
||||
{
|
||||
Log.Info("We have no requests to check if they are available on Plex.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ValidateSettings(PlexSettings plex, AuthenticationSettings auth)
|
||||
{
|
||||
if (plex?.Ip == null || auth?.PlexAuthToken == null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue