mirror of
https://github.com/cyanfish/naps2.git
synced 2024-10-03 19:07:17 +03:00
Escl: Add timeouts to tests
This commit is contained in:
parent
7c3b5556b1
commit
6456d1f1e7
@ -8,7 +8,7 @@ namespace NAPS2.Escl.Tests;
|
||||
|
||||
public class ClientServerTests
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Timeout = 60_000)]
|
||||
public async Task ClientServer()
|
||||
{
|
||||
var job = Substitute.For<IEsclScanJob>();
|
||||
|
@ -12,7 +12,7 @@ namespace NAPS2.Sdk.Tests.Remoting;
|
||||
public class FallbackScanServerTests(ITestOutputHelper testOutputHelper) : ScanServerTestsBase(testOutputHelper,
|
||||
EsclSecurityPolicy.None, new X509Certificate2(BinaryResources.testcert))
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanFallbackFromHttpsToHttp()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog);
|
||||
@ -30,7 +30,7 @@ public class FallbackScanServerTests(ITestOutputHelper testOutputHelper) : ScanS
|
||||
ImageAsserts.Similar(ImageResources.dog, images[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanPreventedByTrustedCertificateSecurityPolicy()
|
||||
{
|
||||
var scanResult = _client.Scan(new ScanOptions
|
||||
|
@ -11,13 +11,13 @@ namespace NAPS2.Sdk.Tests.Remoting;
|
||||
public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
: ScanServerTestsBase(testOutputHelper, EsclSecurityPolicy.ServerDisableHttps)
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task FindDevice()
|
||||
{
|
||||
Assert.True(await TryFindClientDevice());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task Scan()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog);
|
||||
@ -29,7 +29,7 @@ public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
ImageAsserts.Similar(ImageResources.dog, images[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanMultiplePages()
|
||||
{
|
||||
_bridge.MockOutput =
|
||||
@ -45,7 +45,7 @@ public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
ImageAsserts.Similar(ImageResources.dog_h_p300, images[2]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanWithCorrectOptions()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog);
|
||||
@ -118,7 +118,7 @@ public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
ImageAsserts.Similar(ImageResources.dog_bw, images[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanWithError()
|
||||
{
|
||||
_bridge.Error = new DeviceFeederEmptyException();
|
||||
@ -130,7 +130,7 @@ public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
}).ToListAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanWithErrorAfterPage()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog);
|
||||
@ -149,7 +149,7 @@ public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
Assert.Equal(SdkResources.DevicePaperJam, exception.Message);
|
||||
}
|
||||
|
||||
[Fact(Skip = "Flaky")]
|
||||
[Fact(Timeout = TIMEOUT, Skip = "Flaky")]
|
||||
public async Task ScanProgress()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog, ImageResources.dog);
|
||||
@ -175,7 +175,7 @@ public class ScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
Arg.Is<PageProgressEventArgs>(args => args.PageNumber == 2 && args.Progress == 0.5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanPreventedByHttpsSecurityPolicy()
|
||||
{
|
||||
var scanResult = _client.Scan(new ScanOptions
|
||||
|
@ -14,6 +14,8 @@ namespace NAPS2.Sdk.Tests.Remoting;
|
||||
|
||||
public class ScanServerTestsBase : ContextualTests
|
||||
{
|
||||
protected const int TIMEOUT = 60_000;
|
||||
|
||||
protected readonly ScanServer _server;
|
||||
private protected readonly MockScanBridge _bridge;
|
||||
protected readonly ScanController _client;
|
||||
|
@ -11,13 +11,13 @@ namespace NAPS2.Sdk.Tests.Remoting;
|
||||
public class SelfSignedCertScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
: ScanServerTestsBase(testOutputHelper, EsclSecurityPolicy.RequireHttps)
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task FindDevice()
|
||||
{
|
||||
Assert.True(await TryFindClientDevice());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task Scan()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog);
|
||||
@ -33,7 +33,7 @@ public class SelfSignedCertScanServerTests(ITestOutputHelper testOutputHelper)
|
||||
ImageAsserts.Similar(ImageResources.dog, images[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanPreventedByTrustedCertificateSecurityPolicy()
|
||||
{
|
||||
var scanResult = _client.Scan(new ScanOptions
|
||||
|
@ -12,13 +12,13 @@ namespace NAPS2.Sdk.Tests.Remoting;
|
||||
public class TlsScanServerTests(ITestOutputHelper testOutputHelper) : ScanServerTestsBase(testOutputHelper,
|
||||
EsclSecurityPolicy.RequireHttps, new X509Certificate2(BinaryResources.testcert))
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task FindDevice()
|
||||
{
|
||||
Assert.True(await TryFindClientDevice());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task Scan()
|
||||
{
|
||||
_bridge.MockOutput = CreateScannedImages(ImageResources.dog);
|
||||
@ -34,7 +34,7 @@ public class TlsScanServerTests(ITestOutputHelper testOutputHelper) : ScanServer
|
||||
ImageAsserts.Similar(ImageResources.dog, images[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Timeout = TIMEOUT)]
|
||||
public async Task ScanPreventedByTrustedCertificateSecurityPolicy()
|
||||
{
|
||||
var scanResult = _client.Scan(new ScanOptions
|
||||
|
Loading…
Reference in New Issue
Block a user