Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7KB

  1. defmodule Pleroma.OTPVersionTest do
  2. use ExUnit.Case, async: true
  3. alias Pleroma.OTPVersion
  4. describe "get_and_check_version/2" do
  5. test "22.4" do
  6. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  7. "test/fixtures/warnings/otp_version/22.4"
  8. ]) == :ok
  9. end
  10. test "22.1" do
  11. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  12. "test/fixtures/warnings/otp_version/22.1"
  13. ]) == {:error, "22.1"}
  14. end
  15. test "21.1" do
  16. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  17. "test/fixtures/warnings/otp_version/21.1"
  18. ]) == {:error, "21.1"}
  19. end
  20. test "23.0" do
  21. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  22. "test/fixtures/warnings/otp_version/23.0"
  23. ]) == :ok
  24. end
  25. test "undefined" do
  26. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  27. "test/fixtures/warnings/otp_version/undefined"
  28. ]) == :undefined
  29. end
  30. test "not parsable" do
  31. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  32. "test/fixtures/warnings/otp_version/error"
  33. ]) == :undefined
  34. end
  35. test "with non existance file" do
  36. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, [
  37. "test/fixtures/warnings/otp_version/non-exising",
  38. "test/fixtures/warnings/otp_version/22.4"
  39. ]) == :ok
  40. end
  41. test "empty paths" do
  42. assert OTPVersion.get_and_check_version(Tesla.Adapter.Gun, []) == :undefined
  43. end
  44. test "another adapter" do
  45. assert OTPVersion.get_and_check_version(Tesla.Adapter.Hackney, []) == :ok
  46. end
  47. end
  48. end