[skip ci] Fix unit tests on macOS (And probably Unix) (#3647)
This commit is contained in:
parent
e897fb9a12
commit
98a2b9d3ed
12 changed files with 154 additions and 172 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions.TestingHelpers;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -21,7 +22,7 @@ using Xunit;
|
|||
|
||||
namespace API.Tests.Services;
|
||||
|
||||
public class BackupServiceTests
|
||||
public class BackupServiceTests: AbstractFsTest
|
||||
{
|
||||
private readonly ILogger<BackupService> _logger = Substitute.For<ILogger<BackupService>>();
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
|
@ -31,13 +32,6 @@ public class BackupServiceTests
|
|||
private readonly DbConnection _connection;
|
||||
private readonly DataContext _context;
|
||||
|
||||
private const string CacheDirectory = "C:/kavita/config/cache/";
|
||||
private const string CoverImageDirectory = "C:/kavita/config/covers/";
|
||||
private const string BackupDirectory = "C:/kavita/config/backups/";
|
||||
private const string LogDirectory = "C:/kavita/config/logs/";
|
||||
private const string ConfigDirectory = "C:/kavita/config/";
|
||||
private const string BookmarkDirectory = "C:/kavita/config/bookmarks";
|
||||
private const string ThemesDirectory = "C:/kavita/config/theme";
|
||||
|
||||
public BackupServiceTests()
|
||||
{
|
||||
|
|
@ -82,7 +76,7 @@ public class BackupServiceTests
|
|||
|
||||
_context.ServerSetting.Update(setting);
|
||||
_context.Library.Add(new LibraryBuilder("Manga")
|
||||
.WithFolderPath(new FolderPathBuilder("C:/data/").Build())
|
||||
.WithFolderPath(new FolderPathBuilder(Root + "data/").Build())
|
||||
.Build());
|
||||
return await _context.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
|
@ -94,22 +88,6 @@ public class BackupServiceTests
|
|||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private static MockFileSystem CreateFileSystem()
|
||||
{
|
||||
var fileSystem = new MockFileSystem();
|
||||
fileSystem.Directory.SetCurrentDirectory("C:/kavita/");
|
||||
fileSystem.AddDirectory("C:/kavita/config/");
|
||||
fileSystem.AddDirectory(CacheDirectory);
|
||||
fileSystem.AddDirectory(CoverImageDirectory);
|
||||
fileSystem.AddDirectory(BackupDirectory);
|
||||
fileSystem.AddDirectory(LogDirectory);
|
||||
fileSystem.AddDirectory(ThemesDirectory);
|
||||
fileSystem.AddDirectory(BookmarkDirectory);
|
||||
fileSystem.AddDirectory("C:/data/");
|
||||
|
||||
return fileSystem;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue