Merge pull request 'Remove unnecessary KillMode=process' (#359) from r3g_5z/akkoma...
[akkoma] / test / pleroma / http / tzdata_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.HTTP.TzdataTest do
6 use ExUnit.Case
7
8 import Tesla.Mock
9 alias Pleroma.HTTP
10 @url "https://data.iana.org/time-zones/tzdata-latest.tar.gz"
11
12 setup do
13 mock(fn
14 %{method: :head, url: @url} ->
15 %Tesla.Env{status: 200, body: ""}
16
17 %{method: :get, url: @url} ->
18 %Tesla.Env{status: 200, body: "hello"}
19 end)
20
21 :ok
22 end
23
24 describe "head/1" do
25 test "returns successfully result" do
26 assert HTTP.Tzdata.head(@url, [], []) == {:ok, {200, []}}
27 end
28 end
29
30 describe "get/1" do
31 test "returns successfully result" do
32 assert HTTP.Tzdata.get(@url, [], []) == {:ok, {200, [], "hello"}}
33 end
34 end
35 end