diff options
author | Roman Chvanikov <chvanikoff@gmail.com> | 2019-05-29 18:18:22 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@gmail.com> | 2019-05-29 18:18:22 +0300 |
commit | ce47017c8927b8b2d31668d5e32e387d80739502 (patch) | |
tree | be77acd4dc0c6b9d7b6cb8515470e1dae3212aa7 /test/web/oauth/token_test.exs | |
parent | f1f7a11222f4689f000825147d16b366d915f393 (diff) | |
parent | 57e58d26029388a5831cd2ac3fbc419c27c4d7c6 (diff) | |
download | pleroma-ce47017c8927b8b2d31668d5e32e387d80739502.tar.gz pleroma-ce47017c8927b8b2d31668d5e32e387d80739502.zip |
Merge develop
Diffstat (limited to 'test/web/oauth/token_test.exs')
-rw-r--r-- | test/web/oauth/token_test.exs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/web/oauth/token_test.exs b/test/web/oauth/token_test.exs index ad2a49f09..3c07309b7 100644 --- a/test/web/oauth/token_test.exs +++ b/test/web/oauth/token_test.exs @@ -69,4 +69,17 @@ 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 |