diff options
author | Sachin Joshi <satchin.joshi@gmail.com> | 2019-05-23 09:45:12 +0200 |
---|---|---|
committer | Sachin Joshi <satchin.joshi@gmail.com> | 2019-05-23 09:45:12 +0200 |
commit | 0c53d91f3bfe7bbd8d8b9ffd332ac2f57b6aba34 (patch) | |
tree | 724bd17a5ed9d89827b3095e149cfda4fb10fe61 /test/web/oauth/token_test.exs | |
parent | 17bfd000d7d44ff13cf7becbfd9ce08b896d66eb (diff) | |
parent | 75e78d4e239a5c999306e92b181b0e29c52dc9db (diff) | |
download | pleroma-0c53d91f3bfe7bbd8d8b9ffd332ac2f57b6aba34.tar.gz pleroma-0c53d91f3bfe7bbd8d8b9ffd332ac2f57b6aba34.zip |
fix merge conflict
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 |