schedule expired oauth tokens deletion with Oban
This commit is contained in:
parent
c8c17d9c63
commit
3ce658b930
13 changed files with 76 additions and 80 deletions
|
|
@ -69,17 +69,4 @@ defmodule Pleroma.Web.OAuth.TokenTest do
|
|||
|
||||
assert tokens == 2
|
||||
end
|
||||
|
||||
test "deletes expired tokens" do
|
||||
insert(:oauth_token, valid_until: Timex.shift(Timex.now(), days: -3))
|
||||
insert(:oauth_token, valid_until: Timex.shift(Timex.now(), days: -3))
|
||||
t3 = insert(:oauth_token)
|
||||
t4 = insert(:oauth_token, valid_until: Timex.shift(Timex.now(), minutes: 10))
|
||||
{tokens, _} = Token.delete_expired_tokens()
|
||||
assert tokens == 2
|
||||
available_tokens = Pleroma.Repo.all(Token)
|
||||
|
||||
token_ids = available_tokens |> Enum.map(& &1.id)
|
||||
assert token_ids == [t3.id, t4.id]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue