From f11e802275f9533342e3de1627be78ee86222f92 Mon Sep 17 00:00:00 2001 From: Florian Rappl Date: Sun, 15 Jan 2023 17:45:22 +0100 Subject: [PATCH] Replaced httpbin with httpbingo --- .../Cookie/ClassicTests.cs | 27 ++++++-------- .../Network/CookieHandlingTests.cs | 36 ++++++++----------- .../Network/HttpClientRequesterTests.cs | 2 +- 3 files changed, 26 insertions(+), 39 deletions(-) diff --git a/src/AngleSharp.Io.Tests/Cookie/ClassicTests.cs b/src/AngleSharp.Io.Tests/Cookie/ClassicTests.cs index f9491c1..93e9155 100644 --- a/src/AngleSharp.Io.Tests/Cookie/ClassicTests.cs +++ b/src/AngleSharp.Io.Tests/Cookie/ClassicTests.cs @@ -192,7 +192,7 @@ public async Task SettingOneCookiesInOneRequestAppearsInDocument() { if (Helper.IsNetworkAvailable()) { - var url = "https://httpbin.org/cookies/set?k1=v1"; + var url = "https://httpbingo.org/cookies/set?k1=v1"; var config = Configuration.Default.WithCookies().WithDefaultLoader(); var context = BrowsingContext.New(config); var document = await context.OpenAsync(url); @@ -206,7 +206,7 @@ public async Task SettingTwoCookiesInOneRequestAppearsInDocument() { if (Helper.IsNetworkAvailable()) { - var url = "https://httpbin.org/cookies/set?k2=v2&k1=v1"; + var url = "https://httpbingo.org/cookies/set?k2=v2&k1=v1"; var config = Configuration.Default.WithCookies().WithDefaultLoader(); var context = BrowsingContext.New(config); var document = await context.OpenAsync(url); @@ -221,7 +221,7 @@ public async Task SettingThreeCookiesInOneRequestAppearsInDocument() { if (Helper.IsNetworkAvailable()) { - var url = "https://httpbin.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar"; + var url = "https://httpbingo.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar"; var config = Configuration.Default.WithCookies().WithDefaultLoader(); var context = BrowsingContext.New(config); var document = await context.OpenAsync(url); @@ -236,7 +236,7 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest() { if (Helper.IsNetworkAvailable()) { - var baseUrl = "https://httpbin.org/cookies"; + var baseUrl = "https://httpbingo.org/cookies"; var url = baseUrl + "/set?test=baz&k2=v2&k1=v1&foo=bar"; var config = Configuration.Default.WithCookies().WithDefaultLoader(); var context = BrowsingContext.New(config); @@ -244,12 +244,10 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest() var document = await context.OpenAsync(baseUrl); var expected = @"{ - ""cookies"": { - ""foo"": ""bar"", - ""k1"": ""v1"", - ""k2"": ""v2"", - ""test"": ""baz"" - } + ""foo"": ""bar"", + ""k1"": ""v1"", + ""k2"": ""v2"", + ""test"": ""baz"" } ".Replace("\r\n", "\n"); @@ -258,22 +256,19 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest() } [Test] - [Ignore("We should find a replacement for HttpBin.org")] public async Task SettingCookieIsPreservedViaRedirect() { if (Helper.IsNetworkAvailable()) { - var cookieUrl = "https://httpbin.org/cookies/set?test=baz"; - var redirectUrl = "https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fcookies"; + var cookieUrl = "https://httpbingo.org/cookies/set?test=baz"; + var redirectUrl = "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fcookies"; var config = Configuration.Default.WithCookies().WithDefaultLoader(); var context = BrowsingContext.New(config); await context.OpenAsync(cookieUrl); var document = await context.OpenAsync(redirectUrl); Assert.AreEqual(@"{ - ""cookies"": { - ""test"": ""baz"" - } + ""test"": ""baz"" } ".Replace("\r\n", "\n"), document.Body.TextContent); } diff --git a/src/AngleSharp.Io.Tests/Network/CookieHandlingTests.cs b/src/AngleSharp.Io.Tests/Network/CookieHandlingTests.cs index d19ce1f..2d41e18 100644 --- a/src/AngleSharp.Io.Tests/Network/CookieHandlingTests.cs +++ b/src/AngleSharp.Io.Tests/Network/CookieHandlingTests.cs @@ -13,7 +13,7 @@ public async Task SettingOneCookiesInOneRequestAppearsInDocument() { if (Helper.IsNetworkAvailable()) { - var url = "https://httpbin.org/cookies/set?k1=v1"; + var url = "https://httpbingo.org/cookies/set?k1=v1"; var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader(); var context = BrowsingContext.New(config); var document = await context.OpenAsync(url); @@ -27,7 +27,7 @@ public async Task SettingTwoCookiesInOneRequestAppearsInDocument() { if (Helper.IsNetworkAvailable()) { - var url = "https://httpbin.org/cookies/set?k2=v2&k1=v1"; + var url = "https://httpbingo.org/cookies/set?k2=v2&k1=v1"; var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader(); var context = BrowsingContext.New(config); var document = await context.OpenAsync(url); @@ -41,7 +41,7 @@ public async Task SettingThreeCookiesInOneRequestAppearsInDocument() { if (Helper.IsNetworkAvailable()) { - var url = "https://httpbin.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar"; + var url = "https://httpbingo.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar"; var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader(); var context = BrowsingContext.New(config); var document = await context.OpenAsync(url); @@ -55,7 +55,7 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest() { if (Helper.IsNetworkAvailable()) { - var baseUrl = "https://httpbin.org/cookies"; + var baseUrl = "https://httpbingo.org/cookies"; var url = baseUrl + "/set?test=baz&k2=v2&k1=v1&foo=bar"; var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader(); var context = BrowsingContext.New(config); @@ -63,56 +63,48 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest() var document = await context.OpenAsync(baseUrl); Assert.AreEqual(@"{ - ""cookies"": { - ""foo"": ""bar"", - ""k1"": ""v1"", - ""k2"": ""v2"", - ""test"": ""baz"" - } + ""foo"": ""bar"", + ""k1"": ""v1"", + ""k2"": ""v2"", + ""test"": ""baz"" } ".Replace("\r\n", "\n"), document.Body.TextContent); } } [Test] - [Ignore("We should find a replacement for HttpBin.org")] public async Task SettingCookieIsPreservedViaRedirect() { if (Helper.IsNetworkAvailable()) { - var cookieUrl = "https://httpbin.org/cookies/set?test=baz"; - var redirectUrl = "https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fcookies"; + var cookieUrl = "https://httpbingo.org/cookies/set?test=baz"; + var redirectUrl = "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fcookies"; var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader(); var context = BrowsingContext.New(config); await context.OpenAsync(cookieUrl); var document = await context.OpenAsync(redirectUrl); Assert.AreEqual(@"{ - ""cookies"": { - ""test"": ""baz"" - } + ""test"": ""baz"" } ".Replace("\r\n", "\n"), document.Body.TextContent); } } [Test] - [Ignore("We should find a replacement for HttpBin.org")] public async Task SettingCookieIsPreservedViaRedirectToDifferentProtocol() { if (Helper.IsNetworkAvailable()) { - var cookieUrl = "https://httpbin.org/cookies/set?test=baz"; - var redirectUrl = "http://httpbin.org/redirect-to?url=http%3A%2F%2Fhttpbin.org%2Fcookies"; + var cookieUrl = "https://httpbingo.org/cookies/set?test=baz"; + var redirectUrl = "http://httpbingo.org/redirect-to?url=http%3A%2F%2Fhttpbingo.org%2Fcookies"; var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader(); var context = BrowsingContext.New(config); await context.OpenAsync(cookieUrl); var document = await context.OpenAsync(redirectUrl); Assert.AreEqual(@"{ - ""cookies"": { - ""test"": ""baz"" - } + ""test"": ""baz"" } ".Replace("\r\n", "\n"), document.Body.TextContent); } diff --git a/src/AngleSharp.Io.Tests/Network/HttpClientRequesterTests.cs b/src/AngleSharp.Io.Tests/Network/HttpClientRequesterTests.cs index 1a97bd9..eb10ce9 100644 --- a/src/AngleSharp.Io.Tests/Network/HttpClientRequesterTests.cs +++ b/src/AngleSharp.Io.Tests/Network/HttpClientRequesterTests.cs @@ -122,7 +122,7 @@ public async Task EndToEnd() var requester = new HttpClientRequester(httpClient); var configuration = Configuration.Default.With(requester).WithDefaultLoader(); var context = BrowsingContext.New(configuration); - var request = DocumentRequest.Get(Url.Create("http://httpbin.org/html")); + var request = DocumentRequest.Get(Url.Create("http://httpbingo.org/html")); // ACT var response = await context.GetService().FetchAsync(request).Task;