1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Workers.Cron.ClearOauthTokenWorkerTest do
9 alias Pleroma.Workers.Cron.ClearOauthTokenWorker
11 setup do: clear_config([:oauth2, :clean_expired_tokens])
13 test "deletes expired tokens" do
15 valid_until: NaiveDateTime.add(NaiveDateTime.utc_now(), -60 * 10)
18 Pleroma.Config.put([:oauth2, :clean_expired_tokens], true)
19 ClearOauthTokenWorker.perform(%Oban.Job{})
20 assert Pleroma.Repo.all(Pleroma.Web.OAuth.Token) == []