Testing the push method (TODO coherence between return code a physical result)

This commit is contained in:
2024-03-09 21:43:56 +00:00
parent e69462999e
commit 89e1b5a235
10 changed files with 191 additions and 78 deletions

View File

@ -114,7 +114,7 @@ namespace isnd.host.tests
}
public string SPIIndexURI
{
get => server.Addresses.First() + "/v3/index";
get => server.Addresses.First() + "/v3/index.json";
}
[Fact]
@ -170,5 +170,40 @@ namespace isnd.host.tests
}
}
[Fact]
public async Task TestPackagePush()
{
var logger = new TestLogger();
SourceRepository repository = Repository.Factory.GetCoreV3(SPIIndexURI);
PackageUpdateResource pushRes = await repository.GetResourceAsync<PackageUpdateResource>();
SymbolPackageUpdateResourceV3 symbolPackageResource = await repository.GetResourceAsync<SymbolPackageUpdateResourceV3>();
await pushRes.Push(new List<string>{ "../../../../../src/isnd/bin/Release/isnd.1.1.4.nupkg" }, null,
5000, false, GetApiKey, GetSymbolsApiKey, false, false, symbolPackageResource, logger);
}
private string GetSymbolsApiKey(string apiUrl)
{
return GetApiKey(apiUrl);
}
private string GetApiKey(string apiUrl)
{
return server.ProtectedTestingApiKey;
}
}
internal class TestLogger : NuGet.Common.LoggerBase
{
public override void Log(ILogMessage message)
{
Console.WriteLine(message.Message);
}
public async override Task LogAsync(ILogMessage message)
{
Log(message);
}
}
}