Tests: Add a helper method to reduce sleeping times in test.

This will 'time travel', i.e. change the inserted_at and update_at
fields of the object in question. This is used to backdate things
were we used sleeping before to ensure time differences.
This commit is contained in:
lain 2020-12-16 10:39:36 +01:00
commit 0ef0aed205
5 changed files with 18 additions and 11 deletions

View file

@ -73,7 +73,8 @@ defmodule Pleroma.ChatTest do
other_user = insert(:user)
{:ok, chat} = Chat.bump_or_create(user.id, other_user.ap_id)
:timer.sleep(1500)
{:ok, chat} = time_travel(chat, -2)
{:ok, chat_two} = Chat.bump_or_create(user.id, other_user.ap_id)
assert chat.id == chat_two.id