summaryrefslogtreecommitdiff
path: root/test/pleroma/http/tzdata_test.exs
blob: 9c260fbf7a32e6ff4201657493edc99751a89586 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only

defmodule Pleroma.HTTP.TzdataTest do
  use ExUnit.Case

  import Tesla.Mock
  alias Pleroma.HTTP
  @url "https://data.iana.org/time-zones/tzdata-latest.tar.gz"

  setup do
    mock(fn
      %{method: :head, url: @url} ->
        %Tesla.Env{status: 200, body: ""}

      %{method: :get, url: @url} ->
        %Tesla.Env{status: 200, body: "hello"}
    end)

    :ok
  end

  describe "head/1" do
    test "returns successfully result" do
      assert HTTP.Tzdata.head(@url, [], []) == {:ok, {200, []}}
    end
  end

  describe "get/1" do
    test "returns successfully result" do
      assert HTTP.Tzdata.get(@url, [], []) == {:ok, {200, [], "hello"}}
    end
  end
end