Add a mix alias to bump copyright
[akkoma] / test / support / helpers.ex
index 224034521e683e135f7a354711f43aa23352109d..4353d5254b84f78f76254d34a0bae849eccdad48 100644 (file)
@@ -1,5 +1,5 @@
 # Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
 # SPDX-License-Identifier: AGPL-3.0-only
 
 defmodule Pleroma.Tests.Helpers do
@@ -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")