aboutsummaryrefslogtreecommitdiff
path: root/test/support/helpers.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-05-07 15:03:12 +0200
committerlain <lain@soykaf.club>2020-05-07 15:03:12 +0200
commit7ac0cffb34567dd72877e13968a10d206f643ad8 (patch)
tree061fbd748a1b62ddd0555dcb257c39ff5f2ce48a /test/support/helpers.ex
parentdb55dc944581b1d4b50d1608b2e991050ea29bb3 (diff)
parentb7635bf2b6c5251ffc8f3b3b8e1bc7ee9db83b7e (diff)
downloadpleroma-7ac0cffb34567dd72877e13968a10d206f643ad8.tar.gz
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/emojireactvalidator
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)