Skip wxWebRequest authentication tests when using NSURLSession

The NSURLSession-based backend is missing authentication support, so
these tests always fail there, skip them for now.
This commit is contained in:
Vadim Zeitlin
2020-12-30 14:41:17 +01:00
parent a2a409f7a5
commit 63f1260739

View File

@@ -42,6 +42,12 @@ public:
dataSize = 0; dataSize = 0;
} }
static bool UsingNSURLSession()
{
return wxWebSession::GetDefault().GetLibraryVersionInfo().GetName()
== "URLSession";
}
bool InitBaseURL() bool InitBaseURL()
{ {
if ( !wxGetEnv("WX_TEST_WEBREQUEST_URL", &baseURL) ) if ( !wxGetEnv("WX_TEST_WEBREQUEST_URL", &baseURL) )
@@ -182,6 +188,12 @@ TEST_CASE_METHOD(RequestFixture, "WebRequest", "[net][webrequest]")
SECTION("Server auth BASIC") SECTION("Server auth BASIC")
{ {
if ( UsingNSURLSession() )
{
WARN("NSURLSession backend doesn't support authentication, skipping.");
return;
}
Create("/digest-auth/auth/wxtest/wxwidgets"); Create("/digest-auth/auth/wxtest/wxwidgets");
Run(wxWebRequest::State_Unauthorized, 401); Run(wxWebRequest::State_Unauthorized, 401);
REQUIRE( request.GetAuthChallenge().IsOk() ); REQUIRE( request.GetAuthChallenge().IsOk() );
@@ -193,6 +205,12 @@ TEST_CASE_METHOD(RequestFixture, "WebRequest", "[net][webrequest]")
SECTION("Server auth DIGEST") SECTION("Server auth DIGEST")
{ {
if ( UsingNSURLSession() )
{
WARN("NSURLSession backend doesn't support authentication, skipping.");
return;
}
Create("/digest-auth/auth/wxtest/wxwidgets"); Create("/digest-auth/auth/wxtest/wxwidgets");
Run(wxWebRequest::State_Unauthorized, 401); Run(wxWebRequest::State_Unauthorized, 401);
REQUIRE( request.GetAuthChallenge().IsOk() ); REQUIRE( request.GetAuthChallenge().IsOk() );