From 98167487aa087bc7d90a3ffdfe3461026441823a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Fri, 23 Jun 2023 17:42:56 -0700 Subject: [PATCH] Remove test dependency on httpbin.org httpbin.org is very flaky --- http/client/client_test.go | 52 -------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 http/client/client_test.go diff --git a/http/client/client_test.go b/http/client/client_test.go deleted file mode 100644 index 7c65aa63..00000000 --- a/http/client/client_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -package client // import "miniflux.app/http/client" - -import ( - "testing" -) - -func TestClientWithDelay(t *testing.T) { - clt := New("http://httpbin.org/delay/5") - clt.ClientTimeout = 1 - _, err := clt.Get() - if err == nil { - t.Fatal(`The client should stops after 1 second`) - } -} - -func TestClientWithError(t *testing.T) { - clt := New("http://httpbin.org/status/502") - clt.ClientTimeout = 5 - response, err := clt.Get() - if err != nil { - t.Fatal(err) - } - - if response.StatusCode != 502 { - t.Fatalf(`Unexpected response status code: %d`, response.StatusCode) - } - - if !response.HasServerFailure() { - t.Fatal(`A 502 error is considered as server failure`) - } -} - -func TestClientWithResponseTooLarge(t *testing.T) { - clt := New("http://httpbin.org/bytes/100") - clt.ClientMaxBodySize = 10 - _, err := clt.Get() - if err == nil { - t.Fatal(`The client should fails when reading a response too large`) - } -} - -func TestClientWithBasicAuth(t *testing.T) { - clt := New("http://httpbin.org/basic-auth/testuser/testpassword") - clt.WithCredentials("testuser", "testpassword") - _, err := clt.Get() - if err != nil { - t.Fatalf(`The client should be authenticated successfully: %v`, err) - } -}