logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

tzdata_test.exs (829B)


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