aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlambda <pleromagit@rogerbraun.net>2019-01-22 14:18:36 +0000
committerlambda <pleromagit@rogerbraun.net>2019-01-22 14:18:36 +0000
commit7d55bb0896dc8b4a424206b5be19cc6705fbdf2b (patch)
treece75583e3b6db0c4d530caeb1c61037647f603ac /test
parentd17a4b18919d05411602454f624381db2a2ac8c7 (diff)
parent34d59e40086ad8adc020bac6d23ab2aa835f267b (diff)
downloadpleroma-7d55bb0896dc8b4a424206b5be19cc6705fbdf2b.tar.gz
Merge branch '502_stats_fix_for_nil_info_deactivated' into 'develop'
[#502] Stats fix (users with nil or missing `info.deactivated` should be treated active) Closes #502 See merge request pleroma/pleroma!696
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index dd84052a3..8443dc856 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -10,6 +10,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
alias Pleroma.Web.{OStatus, CommonAPI}
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.MastodonAPI.FilterView
+ alias Ecto.Changeset
import Pleroma.Factory
import ExUnit.CaptureLog
import Tesla.Mock
@@ -1483,6 +1484,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
{:ok, _} = TwitterAPI.create_status(user, %{"status" => "cofe"})
+ # Stats should count users with missing or nil `info.deactivated` value
+ user = Repo.get(User, user.id)
+ info_change = Changeset.change(user.info, %{deactivated: nil})
+
+ {:ok, _user} =
+ user
+ |> Changeset.change()
+ |> Changeset.put_embed(:info, info_change)
+ |> User.update_and_set_cache()
+
Pleroma.Stats.update_stats()
conn = get(conn, "/api/v1/instance")