From 7a015b1fe2f177bcc4ea5941c454936d3792e935 Mon Sep 17 00:00:00 2001 From: NEETzsche Date: Sat, 22 Jan 2022 12:07:54 -0700 Subject: [PATCH] Make test less erratic by adding five second tolerance --- .../mastodon_api/controllers/filter_controller_test.exs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs index 4f71b40d1..5ed1f34b7 100644 --- a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs @@ -49,7 +49,6 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do assert filter.hide == true end - @tag :erratic test "a filter with expires_in", %{conn: conn, user: user} do in_seconds = 600 @@ -65,12 +64,13 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do assert response["irreversible"] == false - expires_at = + expected_expiration = NaiveDateTime.utc_now() |> NaiveDateTime.add(in_seconds) - |> Pleroma.Web.CommonAPI.Utils.to_masto_date() - assert response["expires_at"] == expires_at + {:ok, actual_expiration} = NaiveDateTime.from_iso8601(response["expires_at"]) + + assert abs(NaiveDateTime.diff(expected_expiration, actual_expiration)) <= 5 filter = Filter.get(response["id"], user)