From c918efa6a768d48dce20c8c90f932f4d6997d007 Mon Sep 17 00:00:00 2001 From: Lars Bahner Date: Mon, 12 Feb 2024 19:49:02 +0100 Subject: [PATCH] Fix warnings in tests --- lib/ex_ipfs/api.ex | 22 ++++++++++++++++--- lib/ex_ipfs/api_streaming_client.ex | 12 +++++----- lib/ex_ipfs/cid.ex | 10 +++++---- lib/ex_ipfs/get.ex | 2 +- lib/ex_ipfs/multibase.ex | 7 ++++-- lib/ex_ipfs/ping_request.ex | 3 +++ lib/ex_ipfs/refs.ex | 3 ++- lib/ex_ipfs/supervisor.ex | 1 + lib/ex_ipfs/utils.ex | 5 ++++- mix.lock | 20 ++++++++--------- test/ex_ipfs/api/api_error_test.exs | 2 +- test/ex_ipfs/api/api_test.exs | 2 +- test/ex_ipfs/cid/cid_base32cid_test.exs | 2 +- test/ex_ipfs/link_test.exs | 4 ++-- .../multibase/multibase_codec_test.exs | 2 +- 15 files changed, 63 insertions(+), 34 deletions(-) diff --git a/lib/ex_ipfs/api.ex b/lib/ex_ipfs/api.ex index 748d937..a40a921 100644 --- a/lib/ex_ipfs/api.ex +++ b/lib/ex_ipfs/api.ex @@ -24,13 +24,29 @@ defmodule ExIpfs.Api do @typedoc """ A type that represents the possible responses from the API. """ - @type response :: binary | map | list | error_response - + @type response :: binary | map | list | error_response | Tesla.Env.t() @typedoc """ A an aggregate type that represents the possible errors that can be returned from the API. """ @type error_response :: - {:error, ExIpfs.Api.error()} | {:error, Tesla.Env.t()} | {:error, atom} + {:error, + atom() + | %{ + :__struct__ => ExIpfs.ApiError | Tesla.Env, + optional(:__client__) => Tesla.Client.t(), + optional(:__module__) => atom(), + optional(:body) => any(), + optional(:code) => integer(), + optional(:headers) => [{any(), any()}], + optional(:message) => binary(), + optional(:method) => + :delete | :get | :head | :options | :patch | :post | :put | :trace, + optional(:opts) => [{any(), any()}], + optional(:query) => [{any(), any()}], + optional(:status) => nil | integer(), + optional(:type) => binary(), + optional(:url) => binary() + }} # Middleware plug(Tesla.Middleware.BaseUrl, @api_url) diff --git a/lib/ex_ipfs/api_streaming_client.ex b/lib/ex_ipfs/api_streaming_client.ex index 240266d..08bd976 100644 --- a/lib/ex_ipfs/api_streaming_client.ex +++ b/lib/ex_ipfs/api_streaming_client.ex @@ -5,12 +5,6 @@ defmodule ExIpfs.ApiStreamingClient do require Logger - @spec new( - pid, - binary, - :infinity | integer, - list - ) :: {:error, any} | {:ok, any} | {:ok, integer, list} | {:ok, integer, list, any} @doc """ Starts a stream client and returns a reference to the client. ## Parameters @@ -19,6 +13,12 @@ defmodule ExIpfs.ApiStreamingClient do - timeout: The timeout for the stream. Defaults to infinity. - query_options: A list of query options to add to the url. """ + @spec new(pid, binary) :: + {:error, any} | {:ok, any} | {:ok, integer, list} | {:ok, integer, list, any} + @spec new(pid, binary, :infinity | integer) :: + {:error, any} | {:ok, any} | {:ok, integer, list} | {:ok, integer, list, any} + @spec new(pid, binary, :infinity | integer, list) :: + {:error, any} | {:ok, any} | {:ok, integer, list} | {:ok, integer, list, any} def new(pid, url, timeout \\ :infinity, query_options \\ []) do Logger.debug( "Starting IPFS API stream client for #{url} with query options #{inspect(query_options)}" diff --git a/lib/ex_ipfs/cid.ex b/lib/ex_ipfs/cid.ex index b179efa..275556e 100644 --- a/lib/ex_ipfs/cid.ex +++ b/lib/ex_ipfs/cid.ex @@ -37,6 +37,7 @@ defmodule ExIpfs.Cid do List available multibase encodings. """ + @spec bases() :: {:ok, list} | ExIpfs.Api.error_response() @spec bases(list()) :: {:ok, list} | ExIpfs.Api.error_response() def bases(opts \\ []), do: @@ -53,8 +54,8 @@ defmodule ExIpfs.Cid do `numeric` - Show codec numeric code. `supported` - Show only supported codecs. """ - @spec codecs(list()) :: - {:ok, [ExIpfs.multi_codec()]} | ExIpfs.Api.error_response() + @spec codecs() :: {:ok, [ExIpfs.multi_codec()]} | ExIpfs.Api.error_response() + @spec codecs(list()) :: {:ok, [ExIpfs.multi_codec()]} | ExIpfs.Api.error_response() def codecs(opts \\ []), do: post_query("/cid/codecs", query: opts) @@ -74,6 +75,7 @@ defmodule ExIpfs.Cid do `b` - Multibase to display CID in. `mc` - Multicodec. """ + @spec format(binary()) :: {:ok, any} | ExIpfs.Api.error_response() @spec format(binary(), list()) :: {:ok, any} | ExIpfs.Api.error_response() def format(cid, opts \\ []), do: @@ -89,8 +91,8 @@ defmodule ExIpfs.Cid do `supported` - Show only supported hashes. """ - @spec hashes(list()) :: - {:ok, ExIpfs.multi_hash()} | ExIpfs.Api.error_response() + @spec hashes() :: {:ok, ExIpfs.multi_hash()} | ExIpfs.Api.error_response() + @spec hashes(list()) :: {:ok, ExIpfs.multi_hash()} | ExIpfs.Api.error_response() def hashes(opts \\ []), do: post_query("/cid/hashes", query: opts) diff --git a/lib/ex_ipfs/get.ex b/lib/ex_ipfs/get.ex index 201caee..0da88dc 100644 --- a/lib/ex_ipfs/get.ex +++ b/lib/ex_ipfs/get.ex @@ -8,6 +8,7 @@ defmodule ExIpfs.Get do defstruct [:path, :fspath, :name, :content, archive: false] @doc false + @spec get(Path.t()) :: {:ok, Path.t()} | ExIpfs.Api.error_response() @spec get(Path.t(), list) :: {:ok, Path.t()} | ExIpfs.Api.error_response() def get(path, opts \\ []) do content = get_get_data(path, opts) @@ -22,7 +23,6 @@ defmodule ExIpfs.Get do end end - # @spec get_get_data(path, opts) :: {:ok, fspath} | ExIpfs.Api.error_response defp get_get_data(path, opts) do options = create_query_opts(opts) diff --git a/lib/ex_ipfs/multibase.ex b/lib/ex_ipfs/multibase.ex index 5afd40c..e88fd9c 100644 --- a/lib/ex_ipfs/multibase.ex +++ b/lib/ex_ipfs/multibase.ex @@ -57,12 +57,14 @@ defmodule ExIpfs.Multibase do ## Options `b` - Multibase encoding to use. """ + @spec encode!(binary) :: binary() | ExIpfs.Api.error_response() @spec encode!(binary, list) :: binary() | ExIpfs.Api.error_response() def encode!(data, opts \\ []) when is_binary(data) do multipart_content(data) |> post_multipart("/multibase/encode", query: opts) end + @spec encode(binary) :: {:ok, binary()} | ExIpfs.Api.error_response() @spec encode(binary, list) :: {:ok, binary()} | ExIpfs.Api.error_response() def encode(data, opts \\ []) @@ -83,8 +85,8 @@ defmodule ExIpfs.Multibase do prefix - Only list encodings with the given prefix. numeric - Only list encodings with the given numeric code. """ - @spec list(list()) :: - {:ok, [codec()]} | ExIpfs.Api.error_response() + @spec list() :: {:ok, [codec()]} | ExIpfs.Api.error_response() + @spec list(list()) :: {:ok, [codec()]} | ExIpfs.Api.error_response() def list(opts \\ []) do post_query("/multibase/list", query: opts) |> filter_empties() @@ -103,6 +105,7 @@ defmodule ExIpfs.Multibase do ## Options `b` - Multibase encoding to use """ + @spec transcode(binary) :: {:ok, any} | ExIpfs.Api.error_response() @spec transcode(binary, list()) :: {:ok, any} | ExIpfs.Api.error_response() def transcode(data, opts \\ []) do multipart_content(data) diff --git a/lib/ex_ipfs/ping_request.ex b/lib/ex_ipfs/ping_request.ex index 5329751..26fdb7e 100644 --- a/lib/ex_ipfs/ping_request.ex +++ b/lib/ex_ipfs/ping_request.ex @@ -4,6 +4,9 @@ defmodule ExIpfs.PingRequest do @enforce_keys [:request_id, :pid, :peer_id, :timeout, :query_options] defstruct request_id: nil, pid: nil, peer_id: nil, timeout: :infinity, query_options: [] + @spec new(ExIpfs.peer_id()) :: ExIpfs.Ping.request() + @spec new(ExIpfs.peer_id(), pid) :: ExIpfs.Ping.request() + @spec new(ExIpfs.peer_id(), pid, atom | integer) :: ExIpfs.Ping.request() @spec new(ExIpfs.peer_id(), pid, atom | integer, list) :: ExIpfs.Ping.request() def new(peer, pid \\ self(), timeout \\ :infinity, opts \\ []) do %__MODULE__{ diff --git a/lib/ex_ipfs/refs.ex b/lib/ex_ipfs/refs.ex index cf36e35..55c0cbf 100644 --- a/lib/ex_ipfs/refs.ex +++ b/lib/ex_ipfs/refs.ex @@ -41,7 +41,8 @@ defmodule ExIpfs.Refs do """ # This is not suitable for unit testing. # coveralls-ignore-start - @spec refs(Path.t(), list()) :: {:ok, any} | ExIpfs.Api.error_response() + @spec refs(Path.t()) :: ExIpfs.Api.error_response() + @spec refs(Path.t(), list()) :: ExIpfs.Api.error_response() def refs(path, opts \\ []), do: post_query("/refs?arg=" <> path, query: opts) diff --git a/lib/ex_ipfs/supervisor.ex b/lib/ex_ipfs/supervisor.ex index 19e0371..e8167ec 100644 --- a/lib/ex_ipfs/supervisor.ex +++ b/lib/ex_ipfs/supervisor.ex @@ -9,6 +9,7 @@ defmodule ExIpfs.Supervisor do Supervisor.start_link(__MODULE__, :ok, opts) end + # @spec init(:ok) :: {:ok, {:supervisor, [any()], :permanent}} def init(:ok) do children = [] diff --git a/lib/ex_ipfs/utils.ex b/lib/ex_ipfs/utils.ex index f359982..609f6a4 100644 --- a/lib/ex_ipfs/utils.ex +++ b/lib/ex_ipfs/utils.ex @@ -84,6 +84,7 @@ defmodule ExIpfs.Utils do This pattern is used in the IPFS API. The file path is relative to the base directory. This is to avoid leaking irrelevant paths to the server. """ + @dialyzer {:no_return, multipart_add_file: 3} @spec multipart_add_file(Multipart.t(), Path.t(), Path.t()) :: Multipart.t() def multipart_add_file(mp, fspath, basedir) do relative_filename = String.replace(fspath, basedir <> "/", "") @@ -99,6 +100,7 @@ defmodule ExIpfs.Utils do Creates a multipart request from a binary. The filename should always be "file". Because the IPFS API expects this. """ + @spec multipart_content(binary) :: Tesla.Multipart.t() @spec multipart_content(binary, binary) :: Multipart.t() def multipart_content(data, type \\ "file") when is_binary(data) and is_binary(type) do Multipart.new() @@ -118,7 +120,7 @@ defmodule ExIpfs.Utils do - multipart: The multipart request to add the files to. - fspath: The path to the directory to add to the multipart request. """ - + @dialyzer {:no_return, multipart_add_files: 2} @spec multipart_add_files(Multipart.t(), Path.t()) :: Multipart.t() def multipart_add_files(multipart, fspath) do with basedir <- Path.dirname(fspath) do @@ -174,6 +176,7 @@ defmodule ExIpfs.Utils do [{"content_type", "application/json"}, {"x_my_header", "value"}] """ + @spec recase_headers(list()) :: list() @spec recase_headers(list, :kebab | :snake) :: list def recase_headers(headers, format \\ :snake) when is_list(headers) do case format do diff --git a/mix.lock b/mix.lock index 46a3113..5de023a 100644 --- a/mix.lock +++ b/mix.lock @@ -1,28 +1,28 @@ %{ - "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, + "bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"}, "certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"}, - "credo": {:hex, :credo, "1.7.1", "6e26bbcc9e22eefbff7e43188e69924e78818e2fe6282487d0703652bc20fd62", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e9871c6095a4c0381c89b6aa98bc6260a8ba6addccf7f6a53da8849c748a58a2"}, - "dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"}, + "credo": {:hex, :credo, "1.7.4", "68ca5cf89071511c12fd9919eb84e388d231121988f6932756596195ccf7fd35", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "9cf776d062c78bbe0f0de1ecaee183f18f2c3ec591326107989b054b7dddefc2"}, + "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_doc": {:hex, :ex_doc, "0.30.6", "5f8b54854b240a2b55c9734c4b1d0dd7bdd41f71a095d42a70445c03cf05a281", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bd48f2ddacf4e482c727f9293d9498e0881597eae6ddc3d9562bd7923375109f"}, + "ex_doc": {:hex, :ex_doc, "0.31.1", "8a2355ac42b1cc7b2379da9e40243f2670143721dd50748bf6c3b1184dae2089", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.1", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "3178c3a407c557d8343479e1ff117a96fd31bafe52a039079593fb0524ef61b0"}, "excoveralls": {:hex, :excoveralls, "0.18.0", "b92497e69465dc51bc37a6422226ee690ab437e4c06877e836f1c18daeb35da9", [:mix], [{:castore, "~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1109bb911f3cb583401760be49c02cbbd16aed66ea9509fc5479335d284da60b"}, - "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "file_system": {:hex, :file_system, "1.0.0", "b689cc7dcee665f774de94b5a832e578bd7963c8e637ef940cd44327db7de2cd", [:mix], [], "hexpm", "6752092d66aec5a10e662aefeed8ddb9531d79db0bc145bb8c40325ca1d8536d"}, "hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, "jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"}, - "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, + "makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"}, - "makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.4", "29563475afa9b8a2add1b7a9c8fb68d06ca7737648f28398e04461f008b69521", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f4ed47ecda66de70dd817698a703f8816daa91272e7e45812469498614ae8b29"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, "nanoid": {:hex, :nanoid, "2.1.0", "d192a5bf1d774258bc49762b480fca0e3128178fa6d35a464af2a738526607fd", [:mix], [], "hexpm", "ebc7a342d02d213534a7f93a091d569b9fea7f26fcd3a638dc655060fc1f76ac"}, - "nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "recase": {:hex, :recase, "0.7.0", "3f2f719f0886c7a3b7fe469058ec539cb7bbe0023604ae3bce920e186305e5ae", [:mix], [], "hexpm", "36f5756a9f552f4a94b54a695870e32f4e72d5fad9c25e61bc4a3151c08a4e0c"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"}, "temp": {:hex, :temp, "0.4.7", "2c78482cc2294020a4bc0c95950b907ff386523367d4e63308a252feffbea9f2", [:mix], [], "hexpm", "6af19e7d6a85a427478be1021574d1ae2a1e1b90882586f06bde76c63cd03e0d"}, - "tesla": {:hex, :tesla, "1.7.0", "a62dda2f80d4f8a925eb7b8c5b78c461e0eb996672719fe1a63b26321a5f8b4e", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "2e64f01ebfdb026209b47bc651a0e65203fcff4ae79c11efb73c4852b00dc313"}, + "tesla": {:hex, :tesla, "1.8.0", "d511a4f5c5e42538d97eef7c40ec4f3e44effdc5068206f42ed859e09e51d1fd", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.13", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, ">= 1.0.0", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "4.4.2", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:msgpax, "~> 2.3", [hex: :msgpax, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "10501f360cd926a309501287470372af1a6e1cbed0f43949203a4c13300bc79f"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } diff --git a/test/ex_ipfs/api/api_error_test.exs b/test/ex_ipfs/api/api_error_test.exs index af7e223..fa65b28 100644 --- a/test/ex_ipfs/api/api_error_test.exs +++ b/test/ex_ipfs/api/api_error_test.exs @@ -39,6 +39,6 @@ defmodule ExIpfs.ApiErrorTest do test "passes on error data" do data = {:error, %{"Message" => "message", "Code" => 0}} - assert {:error, data} = ApiError.new({:error, data}) + assert {:error, _} = ApiError.new({:error, data}) end end diff --git a/test/ex_ipfs/api/api_test.exs b/test/ex_ipfs/api/api_test.exs index 755559f..42abbb8 100644 --- a/test/ex_ipfs/api/api_test.exs +++ b/test/ex_ipfs/api/api_test.exs @@ -21,7 +21,7 @@ defmodule ExIpfs.ApiTest do {:error, bin} = Ipfs.get("test_case") assert bin.message === - "invalid path \"test_case\": invalid cid: illegal base32 data at input byte 3" + "invalid path \"test_case\": path does not have enough components" assert bin.code === 0 end diff --git a/test/ex_ipfs/cid/cid_base32cid_test.exs b/test/ex_ipfs/cid/cid_base32cid_test.exs index f497dd0..1542cef 100644 --- a/test/ex_ipfs/cid/cid_base32cid_test.exs +++ b/test/ex_ipfs/cid/cid_base32cid_test.exs @@ -29,6 +29,6 @@ defmodule ExIpfs.CidBase32CIDTest do "Code" => 0 } - assert {:error, data} = Base32CID.new({:error, data}) + assert {:error, _} = Base32CID.new({:error, data}) end end diff --git a/test/ex_ipfs/link_test.exs b/test/ex_ipfs/link_test.exs index 03a5692..50d6708 100644 --- a/test/ex_ipfs/link_test.exs +++ b/test/ex_ipfs/link_test.exs @@ -36,7 +36,7 @@ defmodule ExIpfs.LinkTest do end test "passes on error data" do - {:error, result} = Link.new({:error, @data}) - assert result == @data + {:error, result} = Link.new({:error, @data_atom}) + assert result == @data_atom end end diff --git a/test/ex_ipfs/multibase/multibase_codec_test.exs b/test/ex_ipfs/multibase/multibase_codec_test.exs index 0e291ba..1a62f88 100644 --- a/test/ex_ipfs/multibase/multibase_codec_test.exs +++ b/test/ex_ipfs/multibase/multibase_codec_test.exs @@ -26,7 +26,7 @@ defmodule ExIpfs.MultibaseCodecTest do end test "passed on error data" do - data = {:error} + _data = {:error} assert {:error, @data} = MultibaseCodec.new({:error, @data}) end end