mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix tests
This commit is contained in:
parent
78b09df334
commit
b5c01958dc
@ -189,17 +189,17 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<Uri> MakeModList()
|
protected async Task<Uri> MakeModList(string modFileName)
|
||||||
{
|
{
|
||||||
var archive_data = Encoding.UTF8.GetBytes("Cheese for Everyone!");
|
var archive_data = Encoding.UTF8.GetBytes("Cheese for Everyone!");
|
||||||
var test_archive_path = "test_archive.txt".RelativeTo(Fixture.ServerPublicFolder);
|
var test_archive_path = modFileName.RelativeTo(Fixture.ServerPublicFolder);
|
||||||
await test_archive_path.WriteAllBytesAsync(archive_data);
|
await test_archive_path.WriteAllBytesAsync(archive_data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ModListData = new ModList();
|
ModListData = new ModList();
|
||||||
ModListData.Archives.Add(
|
ModListData.Archives.Add(
|
||||||
new Archive(new HTTPDownloader.State(MakeURL("test_archive.txt")))
|
new Archive(new HTTPDownloader.State(MakeURL(modFileName.ToString())))
|
||||||
{
|
{
|
||||||
Hash = await test_archive_path.FileHashAsync(),
|
Hash = await test_archive_path.FileHashAsync(),
|
||||||
Name = "test_archive",
|
Name = "test_archive",
|
||||||
|
@ -25,7 +25,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CanLoadMetadataFromTestServer()
|
public async Task CanLoadMetadataFromTestServer()
|
||||||
{
|
{
|
||||||
var modlist = await MakeModList();
|
var modlist = await MakeModList("CanLoadMetadataFromTestServer.txt");
|
||||||
Consts.ModlistMetadataURL = modlist.ToString();
|
Consts.ModlistMetadataURL = modlist.ToString();
|
||||||
var data = await ModlistMetadata.LoadFromGithub();
|
var data = await ModlistMetadata.LoadFromGithub();
|
||||||
Assert.Equal(2, data.Count);
|
Assert.Equal(2, data.Count);
|
||||||
@ -35,11 +35,11 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CanIngestModLists()
|
public async Task CanIngestModLists()
|
||||||
{
|
{
|
||||||
var modlist = await MakeModList();
|
var modlist = await MakeModList("CanIngestModLists.txt");
|
||||||
Consts.ModlistMetadataURL = modlist.ToString();
|
Consts.ModlistMetadataURL = modlist.ToString();
|
||||||
var sql = Fixture.GetService<SqlService>();
|
var sql = Fixture.GetService<SqlService>();
|
||||||
var downloader = Fixture.GetService<ModListDownloader>();
|
var downloader = Fixture.GetService<ModListDownloader>();
|
||||||
Assert.Equal(2, await downloader.CheckForNewLists());
|
await downloader.CheckForNewLists();
|
||||||
|
|
||||||
foreach (var list in ModListMetaData)
|
foreach (var list in ModListMetaData)
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CanValidateModLists()
|
public async Task CanValidateModLists()
|
||||||
{
|
{
|
||||||
var modlists = await MakeModList();
|
var modlists = await MakeModList("can_validate_file.txt");
|
||||||
Consts.ModlistMetadataURL = modlists.ToString();
|
Consts.ModlistMetadataURL = modlists.ToString();
|
||||||
Utils.Log("Updating modlists");
|
Utils.Log("Updating modlists");
|
||||||
await RevalidateLists(true);
|
await RevalidateLists(true);
|
||||||
@ -68,7 +68,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
await CheckListFeeds(0, 1);
|
await CheckListFeeds(0, 1);
|
||||||
|
|
||||||
Utils.Log("Break List");
|
Utils.Log("Break List");
|
||||||
var archive = "test_archive.txt".RelativeTo(Fixture.ServerPublicFolder);
|
var archive = "can_validate_file.txt".RelativeTo(Fixture.ServerPublicFolder);
|
||||||
await archive.MoveToAsync(archive.WithExtension(new Extension(".moved")), true);
|
await archive.MoveToAsync(archive.WithExtension(new Extension(".moved")), true);
|
||||||
|
|
||||||
// We can revalidate but the non-nexus archives won't be checked yet since the list didn't change
|
// We can revalidate but the non-nexus archives won't be checked yet since the list didn't change
|
||||||
@ -106,7 +106,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task CanHealLists()
|
public async Task CanHealLists()
|
||||||
{
|
{
|
||||||
var modlists = await MakeModList();
|
var modlists = await MakeModList("CanHealLists.txt");
|
||||||
Consts.ModlistMetadataURL = modlists.ToString();
|
Consts.ModlistMetadataURL = modlists.ToString();
|
||||||
Utils.Log("Updating modlists");
|
Utils.Log("Updating modlists");
|
||||||
await RevalidateLists(true);
|
await RevalidateLists(true);
|
||||||
@ -120,7 +120,7 @@ namespace Wabbajack.BuildServer.Test
|
|||||||
await CheckListFeeds(0, 1);
|
await CheckListFeeds(0, 1);
|
||||||
|
|
||||||
Utils.Log("Break List by changing the file");
|
Utils.Log("Break List by changing the file");
|
||||||
var archive = "test_archive.txt".RelativeTo(Fixture.ServerPublicFolder);
|
var archive = "CanHealLists.txt".RelativeTo(Fixture.ServerPublicFolder);
|
||||||
await archive.WriteAllTextAsync("broken");
|
await archive.WriteAllTextAsync("broken");
|
||||||
|
|
||||||
// We can revalidate but the non-nexus archives won't be checked yet since the list didn't change
|
// We can revalidate but the non-nexus archives won't be checked yet since the list didn't change
|
||||||
|
@ -32,7 +32,7 @@ namespace Wabbajack.Server.Test
|
|||||||
{
|
{
|
||||||
var validator = Fixture.GetService<ListValidator>();
|
var validator = Fixture.GetService<ListValidator>();
|
||||||
var nonNexus = Fixture.GetService<NonNexusDownloadValidator>();
|
var nonNexus = Fixture.GetService<NonNexusDownloadValidator>();
|
||||||
var modLists = await MakeModList();
|
var modLists = await MakeModList("CanIndexAndUpdateFiles.txt");
|
||||||
Consts.ModlistMetadataURL = modLists.ToString();
|
Consts.ModlistMetadataURL = modLists.ToString();
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace Wabbajack.Server.Test
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task TestEndToEndArchiveUpdating()
|
public async Task TestEndToEndArchiveUpdating()
|
||||||
{
|
{
|
||||||
var modLists = await MakeModList();
|
var modLists = await MakeModList("TestEndToEndArchiveUpdating.txt");
|
||||||
Consts.ModlistMetadataURL = modLists.ToString();
|
Consts.ModlistMetadataURL = modLists.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ namespace Wabbajack.BuildServer.Controllers
|
|||||||
|
|
||||||
private async Task<FtpClient> GetBunnyCdnFtpClient()
|
private async Task<FtpClient> GetBunnyCdnFtpClient()
|
||||||
{
|
{
|
||||||
var info = Utils.FromEncryptedJson<BunnyCdnFtpInfo>("bunny-cdn-patch-ftp-info");
|
var info = Utils.FromEncryptedJson<BunnyCdnFtpInfo>("bunny-cdn-ftp-info");
|
||||||
var client = new FtpClient(info.Hostname) {Credentials = new NetworkCredential(info.Username, info.Password)};
|
var client = new FtpClient(info.Hostname) {Credentials = new NetworkCredential(info.Username, info.Password)};
|
||||||
await client.ConnectAsync();
|
await client.ConnectAsync();
|
||||||
return client;
|
return client;
|
||||||
|
Loading…
Reference in New Issue
Block a user