guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 1e3ceede32062c08f3a115e9761e95063c08a16f
Author: Giacomo Leidi <[email protected]>
AuthorDate: Sun Sep 21 21:06:51 2025 +0200

    gnu: Add elixir-httpoison.
    
    * gnu/packages/elixir-web.scm (elixir-httpoison): New variable.
    
    Change-Id: Ifeb181da3e07fd46f0044aae185a0aed63c2d25d
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/packages/elixir-web.scm                        | 36 ++++++++++++
 ...ttpoison-tag-network-dependent-test-cases.patch | 64 ++++++++++++++++++++++
 2 files changed, 100 insertions(+)

diff --git a/gnu/packages/elixir-web.scm b/gnu/packages/elixir-web.scm
index c6ac96869a..d5cd092e95 100644
--- a/gnu/packages/elixir-web.scm
+++ b/gnu/packages/elixir-web.scm
@@ -17,6 +17,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages elixir-web)
+  #:use-module (gnu packages)
   #:use-module (gnu packages erlang)
   #:use-module (gnu packages erlang-xyz)
   #:use-module (gnu packages elixir-databases)
@@ -240,6 +241,41 @@ purposes.  Its goal is to be as close as possible to
     (home-page "https://hexdocs.pm/httparrot/";)
     (license license:expat)))
 
+(define-public elixir-httpoison
+  (package
+    (name "elixir-httpoison")
+    (version "2.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/edgurgel/httpoison";)
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0k9g4dc6y30wr9ryxjs23izifpg4dqkkqk8xz39ff27jn5s97k8i"))
+       ;; Waiting for upstream inclusion at
+       ;; https://github.com/edgurgel/httpoison/pull/502
+       (patches
+        (search-patches 
"elixir-httpoison-tag-network-dependent-test-cases.patch"))))
+    (build-system mix-build-system)
+    (arguments
+     (list
+      #:test-flags
+      ;; These tests require network access to badssl.com.
+      #~(list "--exclude" "network")))
+    (native-inputs
+     (list erlang-cowboy
+           elixir-earmark
+           elixir-jason
+           elixir-httparrot
+           elixir-mimic))
+    (propagated-inputs (list erlang-hackney))
+    (synopsis "Yet Another HTTP client for Elixir")
+    (description "Yet Another HTTP client for Elixir powered by hackney.")
+    (home-page "https://hexdocs.pm/httpoison/";)
+    (license license:expat)))
+
 (define-public elixir-mint
   (package
     (name "elixir-mint")
diff --git 
a/gnu/packages/patches/elixir-httpoison-tag-network-dependent-test-cases.patch 
b/gnu/packages/patches/elixir-httpoison-tag-network-dependent-test-cases.patch
new file mode 100644
index 0000000000..763e20a697
--- /dev/null
+++ 
b/gnu/packages/patches/elixir-httpoison-tag-network-dependent-test-cases.patch
@@ -0,0 +1,64 @@
+From 788c481157871fe37becb2ec0280510061174e95 Mon Sep 17 00:00:00 2001
+From: Giacomo Leidi <[email protected]>
+Date: Sun, 21 Sep 2025 20:25:03 +0200
+Subject: [PATCH] tests: Tag network dependent test cases.
+
+Many environments, such as Linux distributions one, segragate builds
+from accessing many system resources like Internet access. Currently it
+is impossible to run the test suite offline, as it needs access to
+badssl.com. This commit tags network dependent test cases to allow them
+to be excluded in offline environments using mix test --exclude.
+
+This holds at least for openSUSE Tumbleweed, NixOS, Guix System and
+probably many others.
+---
+ test/httpoison_test.exs | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/test/httpoison_test.exs b/test/httpoison_test.exs
+index b260c65..f342b59 100644
+--- a/test/httpoison_test.exs
++++ b/test/httpoison_test.exs
+@@ -409,6 +409,7 @@ defmodule HTTPoisonTest do
+       )
+     end
+ 
++    @tag :network
+     test "expired certificate" do
+       assert {:error, %HTTPoison.Error{reason: {:tls_alert, 
{:certificate_expired, reason}}}} =
+                HTTPoison.get("https://expired.badssl.com/";)
+@@ -440,6 +441,7 @@ defmodule HTTPoisonTest do
+                )
+     end
+ 
++    @tag :network
+     test "allows changing TLS1.0 settings" do
+       assert {:error,
+               %HTTPoison.Error{
+@@ -455,6 +457,7 @@ defmodule HTTPoisonTest do
+       end
+     end
+ 
++    @tag :network
+     test "allows changing TLS1.1 settings" do
+       assert {:error,
+               %HTTPoison.Error{
+@@ -472,6 +475,7 @@ defmodule HTTPoisonTest do
+       end
+     end
+ 
++    @tag :network
+     test "does support tls1.2" do
+       if :"tlsv1.2" in :ssl.versions()[:supported] do
+         assert {:ok, _} = HTTPoison.get("https://tls-v1-2.badssl.com:1012/";, 
[])
+@@ -485,6 +489,7 @@ defmodule HTTPoisonTest do
+       end
+     end
+ 
++    @tag :network
+     test "invalid common name" do
+       assert {:error,
+               %HTTPoison.Error{
+-- 
+2.51.0
+

Reply via email to