aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 18:57:16 +0300
committerAlexander Strizhakov <alex.strizhakov@gmail.com>2020-03-03 18:57:16 +0300
commit23f407bf093723344e63eba6a63f5cd58aa7313e (patch)
tree410df7411099ab0962c77924016fcb36cde71c6b /test
parentf98ee730f01de528797e38f27964b69a465662c4 (diff)
downloadpleroma-23f407bf093723344e63eba6a63f5cd58aa7313e.tar.gz
don't test gun itself
Diffstat (limited to 'test')
-rw-r--r--test/gun/gun_test.exs39
1 files changed, 0 insertions, 39 deletions
diff --git a/test/gun/gun_test.exs b/test/gun/gun_test.exs
deleted file mode 100644
index 9f3e0f938..000000000
--- a/test/gun/gun_test.exs
+++ /dev/null
@@ -1,39 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.GunTest do
- use ExUnit.Case
- alias Pleroma.Gun
-
- @moduletag :integration
-
- test "opens connection and receive response" do
- {:ok, conn} = Gun.open('httpbin.org', 443)
- assert is_pid(conn)
- {:ok, _protocol} = Gun.await_up(conn)
- ref = :gun.get(conn, '/get?a=b&c=d')
- assert is_reference(ref)
-
- assert {:response, :nofin, 200, _} = Gun.await(conn, ref)
- assert json = receive_response(conn, ref)
-
- assert %{"args" => %{"a" => "b", "c" => "d"}} = Jason.decode!(json)
-
- {:ok, pid} = Task.start(fn -> Process.sleep(50) end)
-
- :ok = :gun.set_owner(conn, pid)
-
- assert :gun.info(conn).owner == pid
- end
-
- defp receive_response(conn, ref, acc \\ "") do
- case Gun.await(conn, ref) do
- {:data, :nofin, body} ->
- receive_response(conn, ref, acc <> body)
-
- {:data, :fin, body} ->
- acc <> body
- end
- end
-end