aboutsummaryrefslogtreecommitdiff
path: root/test/support/helpers.ex
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2020-06-01 15:48:51 +0400
committerEgor Kislitsyn <egor@kislitsyn.com>2020-06-01 15:48:51 +0400
commita7627bdc7ae67a5c103f968eea02d6b1cf1ef8da (patch)
treee12af401307cfc3120d50c01580cd959f3b2503a /test/support/helpers.ex
parentdecaa64f75f8bd69622fa5fba757f99719f09808 (diff)
parente96765df6b04fe5e9766271a9c62e559392758b2 (diff)
downloadpleroma-a7627bdc7ae67a5c103f968eea02d6b1cf1ef8da.tar.gz
Merge remote-tracking branch 'origin/develop' into global-status-expiration
Diffstat (limited to 'test/support/helpers.ex')
-rw-r--r--test/support/helpers.ex8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/support/helpers.ex b/test/support/helpers.ex
index e68e9bfd2..26281b45e 100644
--- a/test/support/helpers.ex
+++ b/test/support/helpers.ex
@@ -40,12 +40,18 @@ defmodule Pleroma.Tests.Helpers do
clear_config: 2
]
- def to_datetime(naive_datetime) do
+ def to_datetime(%NaiveDateTime{} = naive_datetime) do
naive_datetime
|> DateTime.from_naive!("Etc/UTC")
|> DateTime.truncate(:second)
end
+ def to_datetime(datetime) when is_binary(datetime) do
+ datetime
+ |> NaiveDateTime.from_iso8601!()
+ |> to_datetime()
+ end
+
def collect_ids(collection) do
collection
|> Enum.map(& &1.id)