Delete test/workers/clean_user_sessions_test.exs with huggingface_hub
Browse files
test/workers/clean_user_sessions_test.exs
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
defmodule Plausible.Workers.CleanUserSessionsTest do
|
| 2 |
-
use Plausible.DataCase
|
| 3 |
-
|
| 4 |
-
alias Plausible.Auth.UserSession
|
| 5 |
-
alias Plausible.Workers.CleanUserSessions
|
| 6 |
-
|
| 7 |
-
test "cleans invitation that is more than timeout_at + grace_period days old" do
|
| 8 |
-
grace_cutoff =
|
| 9 |
-
NaiveDateTime.utc_now(:second)
|
| 10 |
-
|> NaiveDateTime.shift(Duration.negate(UserSession.timeout_duration()))
|
| 11 |
-
|> NaiveDateTime.shift(CleanUserSessions.grace_period_duration())
|
| 12 |
-
|
| 13 |
-
ten_days_after = NaiveDateTime.shift(grace_cutoff, day: 10)
|
| 14 |
-
one_day_after = NaiveDateTime.shift(grace_cutoff, day: 1)
|
| 15 |
-
one_day_before = NaiveDateTime.shift(grace_cutoff, day: -1)
|
| 16 |
-
session_to_clean = insert_session(one_day_before)
|
| 17 |
-
session_to_leave1 = insert_session(one_day_after)
|
| 18 |
-
session_to_leave2 = insert_session(ten_days_after)
|
| 19 |
-
|
| 20 |
-
CleanUserSessions.perform(nil)
|
| 21 |
-
|
| 22 |
-
refute Repo.reload(session_to_clean)
|
| 23 |
-
assert Repo.reload(session_to_leave1)
|
| 24 |
-
assert Repo.reload(session_to_leave2)
|
| 25 |
-
end
|
| 26 |
-
|
| 27 |
-
defp insert_session(now) do
|
| 28 |
-
user = insert(:user)
|
| 29 |
-
|
| 30 |
-
user
|
| 31 |
-
|> UserSession.new_session("Unknown", now: now)
|
| 32 |
-
|> Repo.insert!()
|
| 33 |
-
end
|
| 34 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|