diff --git a/EmbyStat.Common/EmbyStat.Common.csproj b/EmbyStat.Common/EmbyStat.Common.csproj index 08c8719a5..ce2f6cc46 100644 --- a/EmbyStat.Common/EmbyStat.Common.csproj +++ b/EmbyStat.Common/EmbyStat.Common.csproj @@ -24,13 +24,13 @@ - + - + diff --git a/EmbyStat.Common/Models/OptionSerializerAttribute.cs b/EmbyStat.Common/Models/OptionSerializerAttribute.cs index bf37ac10b..0db5d6d2d 100644 --- a/EmbyStat.Common/Models/OptionSerializerAttribute.cs +++ b/EmbyStat.Common/Models/OptionSerializerAttribute.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.IO; +using CommandLine; namespace EmbyStat.Common.Models; @@ -7,14 +9,33 @@ namespace EmbyStat.Common.Models; public class OptionSerializerAttribute : Attribute { private string Key { get; } + private bool NeedsCurrentDirPrefix { get; } public OptionSerializerAttribute(string key) { Key = key; } + + public OptionSerializerAttribute(string key, bool needsCurrentDirPrefix) + { + Key = key; + NeedsCurrentDirPrefix = needsCurrentDirPrefix; + } public KeyValuePair ToKeyValuePair(T value) { - return new KeyValuePair(Key, value.ToString()); + if (NeedsCurrentDirPrefix && value != null) + { + var path = value.Cast(); + if (path.StartsWith('/')) + { + path = path.Remove(0, 1); + } + + path = Path.Combine(Directory.GetCurrentDirectory(), path); + return new KeyValuePair(Key, path); + } + + return new KeyValuePair(Key, value?.ToString()); } } \ No newline at end of file diff --git a/EmbyStat.Common/Models/StartupOptions.cs b/EmbyStat.Common/Models/StartupOptions.cs index ae100d2cc..a8fee6117 100644 --- a/EmbyStat.Common/Models/StartupOptions.cs +++ b/EmbyStat.Common/Models/StartupOptions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using CommandLine; @@ -11,20 +12,20 @@ public class StartupOptions [OptionSerializer("Hosting:Port")] public int? Port { get; set; } - [Option('n', "disable-updates", Required = false, Default = null, HelpText = "Disable all update flow and pages on the server.")] - [OptionSerializer("UpdatesDisabled")] + [Option('n', "enable-updates", Required = false, Default = null, HelpText = "Disable all update flow and pages on the server.")] + [OptionSerializer("SystemConfig:CanUpdate")] public bool? NoUpdates { get; set; } - [Option('d', "data-dir", Required = false, Default = "", HelpText = "Folder where database is stored, default is ")] - [OptionSerializer("Dirs:Data")] + [Option('d', "data-dir", Required = false, Default = "data", HelpText = "Folder where database is stored, default is /data")] + [OptionSerializer("SystemConfig:Dirs:Data", true)] public string DataDir { get; set; } - [Option('l', "log-dir", Required = false, Default = "", HelpText = "Folder where log files are stored, default is /logs")] - [OptionSerializer("Dirs:Logs")] + [Option('l', "log-dir", Required = false, Default = "logs", HelpText = "Folder where log files are stored, default is /logs")] + [OptionSerializer("SystemConfig:Dirs:Logs", true)] public string LogDir { get; set; } - [Option('c', "config-dir", Required = false, Default = "", HelpText = "Folder where config files are stored, default is ")] - [OptionSerializer("Dirs:Config")] + [Option('c', "config-dir", Required = false, Default = "config", HelpText = "Folder where config files are stored, default is /config")] + [OptionSerializer("SystemConfig:Dirs:Config", true)] public string ConfigDir { get; set; } [Option('g', "log-level", Required = false, Default = null, HelpText = "Set the proper log level\n1: Debug\n2: Information")] diff --git a/EmbyStat.Configuration/Config.cs b/EmbyStat.Configuration/Config.cs index 886bd0a38..a24117266 100644 --- a/EmbyStat.Configuration/Config.cs +++ b/EmbyStat.Configuration/Config.cs @@ -35,7 +35,7 @@ public SystemConfig() public string AppName { get; set; } public Guid? Id { get; set; } public bool UpdateInProgress { get; set; } - public bool UpdatesDisabled { get; set; } + public bool CanUpdate { get; set; } public long Migration { get; set; } public UpdateTrain UpdateTrain { get; set; } public Updater Updater { get; set; } @@ -98,6 +98,7 @@ public class Dirs public string Updater { get; set; } public string Logs { get; set; } public string Data { get; set; } + public string Config { get; set; } } public class Jwt diff --git a/EmbyStat.Configuration/ConfigurationService.cs b/EmbyStat.Configuration/ConfigurationService.cs index 9a3887aad..44ef70161 100644 --- a/EmbyStat.Configuration/ConfigurationService.cs +++ b/EmbyStat.Configuration/ConfigurationService.cs @@ -21,7 +21,7 @@ public Config Get() private async Task WriteConfiguration(Config config) { - var path = Path.Combine("config", "config.json"); + var path = Path.Combine(config.SystemConfig.Dirs.Config, "config.json"); if (!File.Exists(path)) { throw new InvalidConfigFileException($"Config file cannot be found at {path}"); diff --git a/EmbyStat.Controllers/Job/JobController.cs b/EmbyStat.Controllers/Job/JobController.cs index aaee69c16..190b5378e 100644 --- a/EmbyStat.Controllers/Job/JobController.cs +++ b/EmbyStat.Controllers/Job/JobController.cs @@ -41,7 +41,7 @@ public IActionResult GetAll() { var jobs = _jobService.GetAll(); - if (_config.SystemConfig.UpdatesDisabled) + if (!_config.SystemConfig.CanUpdate) { jobs = jobs.Where(x => x.Id != Constants.JobIds.CheckUpdateId); } @@ -68,7 +68,7 @@ public async Task UpdateTrigger(Guid id, string cron) { if (await _jobService.UpdateTrigger(id, cron)) { - _jobInitializer.UpdateTrigger(id, cron, _config.SystemConfig.UpdatesDisabled); + _jobInitializer.UpdateTrigger(id, cron, _config.SystemConfig.CanUpdate); return NoContent(); } diff --git a/EmbyStat.Controllers/Settings/ConfigViewModel.cs b/EmbyStat.Controllers/Settings/ConfigViewModel.cs index e91415589..2be276d21 100644 --- a/EmbyStat.Controllers/Settings/ConfigViewModel.cs +++ b/EmbyStat.Controllers/Settings/ConfigViewModel.cs @@ -30,7 +30,7 @@ public class SystemConfigViewModel public string AppName { get; set; } public Guid? Id { get; set; } public bool UpdateInProgress { get; set; } - public bool UpdatesDisabled { get; set; } + public bool CanUpdate { get; set; } public long Migration { get; set; } public int UpdateTrain { get; set; } public RollbarViewModel Rollbar { get; set; } diff --git a/EmbyStat.Core/MediaServers/MediaServerRepository.cs b/EmbyStat.Core/MediaServers/MediaServerRepository.cs index cbde5563c..f27df4c37 100644 --- a/EmbyStat.Core/MediaServers/MediaServerRepository.cs +++ b/EmbyStat.Core/MediaServers/MediaServerRepository.cs @@ -288,10 +288,13 @@ public Task> GetAllLibraries(LibraryType type, bool synced) public async Task SetLibraryAsSynced(string[] libraryIds, LibraryType type) { - var libraries = await _context.Libraries.Where(x => x.Type == type).ToListAsync(); + var libraries = await _context.Libraries + .Where(x => x.Type == type) + .ToListAsync(); + foreach (var library in libraries) { - library.Sync = library.Type == type; + library.Sync = libraryIds.Contains(library.Id); } await _context.SaveChangesAsync(); diff --git a/EmbyStat.Jobs/IJobInitializer.cs b/EmbyStat.Jobs/IJobInitializer.cs index 437d18ef9..cb7276859 100644 --- a/EmbyStat.Jobs/IJobInitializer.cs +++ b/EmbyStat.Jobs/IJobInitializer.cs @@ -4,6 +4,6 @@ namespace EmbyStat.Jobs; public interface IJobInitializer { - void Setup(bool disableUpdates); - void UpdateTrigger(Guid id, string trigger, bool disableUpdates); + void Setup(bool canUpdate); + void UpdateTrigger(Guid id, string trigger, bool canUpdate); } \ No newline at end of file diff --git a/EmbyStat.Jobs/JobInitializer.cs b/EmbyStat.Jobs/JobInitializer.cs index a1d2149df..eb979a38e 100644 --- a/EmbyStat.Jobs/JobInitializer.cs +++ b/EmbyStat.Jobs/JobInitializer.cs @@ -30,16 +30,16 @@ public JobInitializer(IDatabaseCleanupJob databaseCleanupJob, IPingEmbyJob pingE _movieSyncJob = movieSyncJob; } - public void Setup(bool disableUpdates) + public void Setup(bool canUpdate) { var jobs = _jobService.GetAll(); foreach (var job in jobs) { - UpdateTrigger(job.Id, job.Trigger, disableUpdates); + UpdateTrigger(job.Id, job.Trigger, canUpdate); } } - public void UpdateTrigger(Guid id, string trigger, bool disableUpdates) + public void UpdateTrigger(Guid id, string trigger, bool canUpdate) { if (id == Constants.JobIds.ShowSyncId) { @@ -49,7 +49,7 @@ public void UpdateTrigger(Guid id, string trigger, bool disableUpdates) { _recurringJobManager.AddOrUpdate(id.ToString(), () => _movieSyncJob.Execute(), trigger); } - else if (id == Constants.JobIds.CheckUpdateId && !disableUpdates) + else if (id == Constants.JobIds.CheckUpdateId && canUpdate) { _recurringJobManager.AddOrUpdate(id.ToString(), () => _checkUpdateJob.Execute(), trigger); } diff --git a/EmbyStat.Web/ClientApp/package-lock.json b/EmbyStat.Web/ClientApp/package-lock.json index bf2450be0..a830d9e97 100644 --- a/EmbyStat.Web/ClientApp/package-lock.json +++ b/EmbyStat.Web/ClientApp/package-lock.json @@ -5671,9 +5671,9 @@ "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" }, "eventsource": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz", - "integrity": "sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.1.1.tgz", + "integrity": "sha512-qV5ZC0h7jYIAOhArFJgSfdyz6rALJyb270714o7ZtNnw2WSJ+eexhKtE0O8LYPRsHZHf2osHKZBxGPvm3kPkCA==", "requires": { "original": "^1.0.0" } diff --git a/EmbyStat.Web/ClientApp/src/shared/components/charts/EsPieChart.tsx b/EmbyStat.Web/ClientApp/src/shared/components/charts/EsPieChart.tsx index e8d90b3f1..ae708c576 100644 --- a/EmbyStat.Web/ClientApp/src/shared/components/charts/EsPieChart.tsx +++ b/EmbyStat.Web/ClientApp/src/shared/components/charts/EsPieChart.tsx @@ -1,8 +1,7 @@ import React, {useEffect, useMemo, useState} from 'react'; -import {useTranslation} from 'react-i18next'; import {Cell, Label, Pie, PieChart, ResponsiveContainer, Sector} from 'recharts'; -import {darken, Paper, Stack, Typography, useTheme} from '@mui/material'; +import {darken, Paper, Stack, Typography} from '@mui/material'; import i18n from '../../../i18n'; import {theme} from '../../../styles/theme'; @@ -20,7 +19,7 @@ interface ActiveShapeProps { startAngle: number; endAngle: number; fill: string; - payload: {name: string}; + payload: {label: string}; percent: number; value: number; } @@ -62,7 +61,9 @@ const renderActiveShape = (props: ActiveShapeProps) => { /> - = 0 ? 1 : -1) * 12} y={ey} textAnchor={textAnchor} fill={color}>{`${value}`} + = 0 ? 1 : -1) * 12} y={ey} textAnchor={textAnchor} fill={color}> + {`${value} ${payload.label}`} + = 0 ? 1 : -1) * 12} y={ey} dy={15} fontSize={12} textAnchor={textAnchor} fill={colorDark}> {`${(percent * 100).toFixed(2)}%`} @@ -77,8 +78,6 @@ interface Props { export function EsPieGraph(props: Props) { const {chart, height = 250} = props; - const theme = useTheme(); - const {t} = useTranslation(); const [data, setData] = useState(null!); const [activeIndex, setActiveIndex] = useState(0); const generatePalette = usePalette(); diff --git a/EmbyStat.Web/ClientApp/src/shared/models/settings/Settings.ts b/EmbyStat.Web/ClientApp/src/shared/models/settings/Settings.ts index 1d1387e2e..bf08299d6 100644 --- a/EmbyStat.Web/ClientApp/src/shared/models/settings/Settings.ts +++ b/EmbyStat.Web/ClientApp/src/shared/models/settings/Settings.ts @@ -23,7 +23,7 @@ export interface SystemConfig { appName: string; id: string | null; updateInProgress: boolean; - updatesDisabled: boolean; + canUpdate: boolean; migration: number; updateTrain: number; rollbar: Rollbar; diff --git a/EmbyStat.Web/DefaultConfig.cs b/EmbyStat.Web/DefaultConfig.cs index 74ead43e2..ee0f46c71 100644 --- a/EmbyStat.Web/DefaultConfig.cs +++ b/EmbyStat.Web/DefaultConfig.cs @@ -14,8 +14,6 @@ public static class DefaultConfig Dirs = new Dirs { TempUpdate = "updateFiles", - Data = "data", - Logs = "logs", Updater = "updater" }, Jwt = new Jwt @@ -32,7 +30,7 @@ public static class DefaultConfig Id = Guid.NewGuid(), Migration = 0, UpdateInProgress = false, - UpdatesDisabled = false, + CanUpdate = true, Rollbar = new Configuration.Rollbar(), Updater = new Updater { diff --git a/EmbyStat.Web/Program.cs b/EmbyStat.Web/Program.cs index 39eaeff10..881cd0921 100644 --- a/EmbyStat.Web/Program.cs +++ b/EmbyStat.Web/Program.cs @@ -140,18 +140,19 @@ private static ApplicationModes GetApplicationMode() private static IHost BuildConsoleHost(StartupOptions options) { - CreateFolder("config"); - GenerateDefaultConfiguration(); - var memoryConfig = options.ToKeyValuePairs(); + var dicConfig = memoryConfig.ToDictionary(x => x.Key, x => x.Value); + GenerateDefaultConfiguration(dicConfig["SystemConfig:Dirs:Config"]); var configurationRoot = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile(Path.Combine("config", "config.json"), false, true) + .AddJsonFile(Path.Combine(dicConfig["SystemConfig:Dirs:Config"], "config.json"), false, true) .AddInMemoryCollection(memoryConfig) .Build(); var config = configurationRoot.Get(); + + //Dirs in options object worden hier genegeerd! CreateFolder(config.SystemConfig.Dirs.Logs); CreateFolder(config.SystemConfig.Dirs.Data); @@ -224,9 +225,10 @@ private static void CreateFolder(string folder) } } - private static void GenerateDefaultConfiguration() + private static void GenerateDefaultConfiguration(string configDir) { - var path = Path.Combine(Directory.GetCurrentDirectory(), "config", "config.json"); + CreateFolder(configDir); + var path = Path.Combine(configDir, "config.json"); if (!File.Exists(path)) { using var writer = File.CreateText(path); @@ -319,10 +321,10 @@ private static void LogStartupParameters(Config config, int logLevel, bool servi Log.Information($"\tSSL Port:\t{config.UserConfig.Hosting.SslPort}"); Log.Information($"\tSSL Enabled:\t{config.UserConfig.Hosting.SslEnabled}"); Log.Information($"\tURLs:\t\t{config.UserConfig.Hosting.Url}"); - Log.Information($"\tConfig dir:\tconfig"); + Log.Information($"\tConfig dir:\t{config.SystemConfig.Dirs.Config}"); Log.Information($"\tLog dir:\t{config.SystemConfig.Dirs.Logs}"); Log.Information($"\tData dir:\t{config.SystemConfig.Dirs.Data}"); - Log.Information($"\tCan update:\t{!config.SystemConfig.UpdatesDisabled}"); + Log.Information($"\tCan update:\t{config.SystemConfig.CanUpdate}"); Log.Information($"\tAs service:\t{service}"); Log.Information("--------------------------------------------------------------------"); } diff --git a/EmbyStat.Web/Startup.cs b/EmbyStat.Web/Startup.cs index d00bd022d..2b1cd28f9 100644 --- a/EmbyStat.Web/Startup.cs +++ b/EmbyStat.Web/Startup.cs @@ -313,7 +313,7 @@ private void PerformPostStartup() SetupDirectories(config); accountService?.CreateRoles(); SetMediaServerClientConfiguration(configurationService, clientStrategy); - jobInitializer?.Setup(config.SystemConfig.UpdatesDisabled); + jobInitializer?.Setup(config.SystemConfig.CanUpdate); } RemoveVersionFiles(); diff --git a/Tests.Unit/Builders/ConfigBuilder.cs b/Tests.Unit/Builders/ConfigBuilder.cs index 1ad6638b3..bc5c7af2a 100644 --- a/Tests.Unit/Builders/ConfigBuilder.cs +++ b/Tests.Unit/Builders/ConfigBuilder.cs @@ -21,7 +21,7 @@ public ConfigBuilder() UpdateTrain = UpdateTrain.Beta, Migration = 0, ProcessName = "EmbyStat", - UpdatesDisabled = false, + CanUpdate = true, Jwt = new Jwt { Audience = "jwt-audience", @@ -136,7 +136,7 @@ public ConfigBuilder WithRollbarSettings(bool state) public ConfigBuilder WithAutoUpdate(bool state) { - _config.SystemConfig.UpdatesDisabled = state; + _config.SystemConfig.CanUpdate = state; return this; } diff --git a/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs b/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs index 652e135cf..b368cd646 100644 --- a/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs +++ b/Tests.Unit/Builders/ViewModels/ConfigViewModelBuilder.cs @@ -20,7 +20,7 @@ public ConfigViewModelBuilder(Config config) ProcessName = config.SystemConfig.ProcessName, Id = config.SystemConfig.Id, UpdateInProgress = config.SystemConfig.UpdateInProgress, - UpdatesDisabled = config.SystemConfig.UpdatesDisabled, + CanUpdate = config.SystemConfig.CanUpdate, Migration = config.SystemConfig.Migration, UpdateTrain = (int)config.SystemConfig.UpdateTrain, Dirs = new DirsViewModel diff --git a/Tests.Unit/Controllers/JobControllerTests.cs b/Tests.Unit/Controllers/JobControllerTests.cs index c2cccf987..1a76935b9 100644 --- a/Tests.Unit/Controllers/JobControllerTests.cs +++ b/Tests.Unit/Controllers/JobControllerTests.cs @@ -30,7 +30,7 @@ public class JobControllerTests private Mock> _options; private Mock _jobHubHelperMock; - private JobController CreateController(bool disableUpdateJob, params Job[] jobs) + private JobController CreateController(bool canUpdate, params Job[] jobs) { var profiles = new MapProfiles(); var configuration = new MapperConfiguration(cfg => cfg.AddProfile(profiles)); @@ -56,9 +56,9 @@ private JobController CreateController(bool disableUpdateJob, params Job[] jobs) .Setup(x => x.Value) .Returns(new Config { - SystemConfig = new SystemConfig() + SystemConfig = new SystemConfig { - UpdatesDisabled = disableUpdateJob + CanUpdate = canUpdate } }); @@ -71,7 +71,7 @@ public void GetAll_Should_Return_All_Jobs() { var jobOne = new Job {Id = Guid.NewGuid()}; var jobTwo = new Job {Id = Guid.NewGuid()}; - var controller = CreateController(false, jobOne, jobTwo); + var controller = CreateController(true, jobOne, jobTwo); var result = controller.GetAll(); result.Should().BeOfType(); @@ -101,7 +101,7 @@ public void GetAll_Should_Return_All_Jobs_Except_Update_Job() var jobOne = new Job {Id = Guid.NewGuid()}; var jobTwo = new Job {Id = Guid.NewGuid()}; var jobThree = new Job {Id = Constants.JobIds.CheckUpdateId}; - var controller = CreateController(true, jobOne, jobTwo, jobThree); + var controller = CreateController(false, jobOne, jobTwo, jobThree); var result = controller.GetAll(); result.Should().BeOfType(); @@ -131,7 +131,7 @@ public void GetById_Should_Return_Correct_Job() { var jobOne = new Job {Id = Guid.NewGuid()}; var jobTwo = new Job {Id = Guid.NewGuid()}; - var controller = CreateController(true, jobOne, jobTwo); + var controller = CreateController(false, jobOne, jobTwo); var result = controller.Get(jobTwo.Id); var jobObject = result as OkObjectResult; @@ -156,7 +156,7 @@ public void GetById_Should_Return_NotFound_If_Job_Is_Not_Found() { var jobOne = new Job {Id = Guid.NewGuid()}; var jobTwo = new Job {Id = Guid.NewGuid()}; - var controller = CreateController(true, jobOne, jobTwo); + var controller = CreateController(false, jobOne, jobTwo); var randomId = Guid.NewGuid(); var result = controller.Get(randomId); @@ -178,7 +178,7 @@ public async Task UpdateTrigger_Should_Update_Correct_Job() { var jobOne = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; var jobTwo = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; - var controller = CreateController(false, jobOne, jobTwo); + var controller = CreateController(true, jobOne, jobTwo); var result = await controller.UpdateTrigger(jobOne.Id, "* * * 1 0"); @@ -188,7 +188,7 @@ public async Task UpdateTrigger_Should_Update_Correct_Job() _options.Verify(x => x.Value, Times.Once); _jobServiceMock.Verify(x => x.UpdateTrigger(jobOne.Id, "* * * 1 0"), Times.Once); - _jobInitializerMock.Verify(x => x.UpdateTrigger(jobOne.Id, "* * * 1 0", false)); + _jobInitializerMock.Verify(x => x.UpdateTrigger(jobOne.Id, "* * * 1 0", true)); _options.Verify(x => x.Value, Times.Once); _options.VerifyNoOtherCalls(); @@ -201,7 +201,7 @@ public async Task UpdateTrigger_Should_Return_Not_found_If_Job_Is_Not_Found() { var jobOne = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; var jobTwo = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; - var controller = CreateController(false, jobOne, jobTwo); + var controller = CreateController(true, jobOne, jobTwo); var randomId = Guid.NewGuid(); var result = await controller.UpdateTrigger(randomId, "* * * 1 0"); @@ -230,7 +230,7 @@ public async Task FireJob_Should_Fire_Correct_Job() var jobOne = new Job {Id = Constants.JobIds.ShowSyncId, Trigger = "* * * * *"}; var jobTwo = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; - var controller = CreateController(false, jobOne, jobTwo); + var controller = CreateController(true, jobOne, jobTwo); var result = await controller.FireJob(jobOne.Id); @@ -254,7 +254,7 @@ public async Task FireJob_Should_Return_NotFound_If_Job_Is_Not_Found() { var jobOne = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; var jobTwo = new Job {Id = Guid.NewGuid(), Trigger = "* * * * *"}; - var controller = CreateController(false, jobOne, jobTwo); + var controller = CreateController(true, jobOne, jobTwo); var randomId = Guid.NewGuid(); var result = await controller.FireJob(randomId); diff --git a/Tests.Unit/Controllers/SettingsControllerTests.cs b/Tests.Unit/Controllers/SettingsControllerTests.cs index 13b4945f0..fb6bf496e 100644 --- a/Tests.Unit/Controllers/SettingsControllerTests.cs +++ b/Tests.Unit/Controllers/SettingsControllerTests.cs @@ -74,7 +74,7 @@ public void IsConfigurationLoaded() settings.SystemConfig.Id.Should().Be(_config.SystemConfig.Id); settings.UserConfig.KeepLogsCount.Should().Be(_config.UserConfig.KeepLogsCount); settings.UserConfig.Language.Should().Be(_config.UserConfig.Language); - settings.SystemConfig.UpdatesDisabled.Should().Be(_config.SystemConfig.UpdatesDisabled); + settings.SystemConfig.CanUpdate.Should().Be(_config.SystemConfig.CanUpdate); settings.UserConfig.ToShortMovie.Should().Be(_config.UserConfig.ToShortMovie); settings.UserConfig.ToShortMovieEnabled.Should().Be(_config.UserConfig.ToShortMovieEnabled); settings.SystemConfig.UpdateInProgress.Should().Be(_config.SystemConfig.UpdateInProgress); diff --git a/Tests.Unit/Jobs/JobInitializerTests.cs b/Tests.Unit/Jobs/JobInitializerTests.cs index 043888cca..008304e1c 100644 --- a/Tests.Unit/Jobs/JobInitializerTests.cs +++ b/Tests.Unit/Jobs/JobInitializerTests.cs @@ -47,7 +47,7 @@ public JobInitializerTests() [Fact] public void Setup_Should_Enable_All_Jobs() { - _jobInitializer.Setup(false); + _jobInitializer.Setup(true); _recurringJobManagerMock.Verify( x => x.AddOrUpdate(Constants.JobIds.CheckUpdateId.ToString(), It.IsAny(), "0 2 * * 1", It.IsAny()), Times.Once()); @@ -68,7 +68,7 @@ public void Setup_Should_Enable_All_Jobs() [Fact] public void Setup_Should_Enable_All_Jobs_Excluding_Update_Job() { - _jobInitializer.Setup(true); + _jobInitializer.Setup(false); _recurringJobManagerMock.Verify( x => x.AddOrUpdate(Constants.JobIds.CheckUpdateId.ToString(), It.IsAny(), "0 2 * * 1", It.IsAny()), Times.Never()); @@ -125,7 +125,7 @@ public void UpdateTrigger_Should_Update_PingEmby_Job_Trigger() [Fact] public void UpdateTrigger_Should_Update_CheckUpdate_Job_Trigger() { - _jobInitializer.UpdateTrigger(Constants.JobIds.CheckUpdateId, "0 3 * * 1", false); + _jobInitializer.UpdateTrigger(Constants.JobIds.CheckUpdateId, "0 3 * * 1", true); _recurringJobManagerMock.Verify( x => x.AddOrUpdate(Constants.JobIds.CheckUpdateId.ToString(), It.IsAny(), "0 3 * * 1", It.IsAny()), Times.Once()); @@ -134,7 +134,7 @@ public void UpdateTrigger_Should_Update_CheckUpdate_Job_Trigger() [Fact] public void UpdateTrigger_Should_Not_Update_CheckUpdate_Job_Trigger() { - _jobInitializer.UpdateTrigger(Constants.JobIds.CheckUpdateId, "0 3 * * 1", true); + _jobInitializer.UpdateTrigger(Constants.JobIds.CheckUpdateId, "0 3 * * 1", false); _recurringJobManagerMock.Verify( x => x.AddOrUpdate(Constants.JobIds.CheckUpdateId.ToString(), It.IsAny(), "0 3 * * 1", It.IsAny()), Times.Never());