diff options
author | lain <lain@soykaf.club> | 2020-12-26 10:26:35 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-12-26 10:26:35 +0000 |
commit | e4f1d8f48c85b8a388d6c3945db157de5ce588c5 (patch) | |
tree | 3a3da119eb71a0536bd5f23226834dfea634d74a /test/support/helpers.ex | |
parent | 88530c02d60900d1e0920d50c6c081a59010ea09 (diff) | |
parent | fecefe68f88014ad2f8b5f290f3b0c7692fa3fef (diff) | |
download | pleroma-e4f1d8f48c85b8a388d6c3945db157de5ce588c5.tar.gz |
Merge branch 'cachex-test' into 'develop'
Test framework overhaul (speed, reliability)
See merge request pleroma/pleroma!3209
Diffstat (limited to 'test/support/helpers.ex')
-rw-r--r-- | test/support/helpers.ex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 224034521..15e8cbd9d 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -55,6 +55,14 @@ defmodule Pleroma.Tests.Helpers do clear_config: 2 ] + def time_travel(entity, seconds) do + new_time = NaiveDateTime.add(entity.inserted_at, seconds) + + entity + |> Ecto.Changeset.change(%{inserted_at: new_time, updated_at: new_time}) + |> Pleroma.Repo.update() + end + def to_datetime(%NaiveDateTime{} = naive_datetime) do naive_datetime |> DateTime.from_naive!("Etc/UTC") |