Merge remote-tracking branch 'origin/develop' into manifest
This commit is contained in:
commit
e4f9cb1c1b
45 changed files with 838 additions and 66 deletions
|
|
@ -34,4 +34,14 @@ defmodule Pleroma.User.QueryTest do
|
|||
assert %{internal: true} |> Query.build() |> Repo.aggregate(:count) == 2
|
||||
end
|
||||
end
|
||||
|
||||
test "is_suggested param" do
|
||||
_user1 = insert(:user, is_suggested: false)
|
||||
user2 = insert(:user, is_suggested: true)
|
||||
|
||||
assert [^user2] =
|
||||
%{is_suggested: true}
|
||||
|> User.Query.build()
|
||||
|> Repo.all()
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1718,6 +1718,38 @@ defmodule Pleroma.UserTest do
|
|||
assert user.banner == %{}
|
||||
end
|
||||
|
||||
describe "set_suggestion" do
|
||||
test "suggests a user" do
|
||||
user = insert(:user, is_suggested: false)
|
||||
refute user.is_suggested
|
||||
{:ok, user} = User.set_suggestion(user, true)
|
||||
assert user.is_suggested
|
||||
end
|
||||
|
||||
test "suggests a list of users" do
|
||||
unsuggested_users = [
|
||||
insert(:user, is_suggested: false),
|
||||
insert(:user, is_suggested: false),
|
||||
insert(:user, is_suggested: false)
|
||||
]
|
||||
|
||||
{:ok, users} = User.set_suggestion(unsuggested_users, true)
|
||||
|
||||
assert Enum.count(users) == 3
|
||||
|
||||
Enum.each(users, fn user ->
|
||||
assert user.is_suggested
|
||||
end)
|
||||
end
|
||||
|
||||
test "unsuggests a user" do
|
||||
user = insert(:user, is_suggested: true)
|
||||
assert user.is_suggested
|
||||
{:ok, user} = User.set_suggestion(user, false)
|
||||
refute user.is_suggested
|
||||
end
|
||||
end
|
||||
|
||||
test "get_public_key_for_ap_id fetches a user that's not in the db" do
|
||||
assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin")
|
||||
end
|
||||
|
|
@ -2410,13 +2442,16 @@ defmodule Pleroma.UserTest do
|
|||
test "active_user_count/1" do
|
||||
insert(:user)
|
||||
insert(:user, %{local: false})
|
||||
insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -5)})
|
||||
insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -3)})
|
||||
insert(:user, %{last_active_at: NaiveDateTime.utc_now()})
|
||||
insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), days: -15)})
|
||||
insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -6)})
|
||||
insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), months: -7)})
|
||||
insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), years: -2)})
|
||||
|
||||
assert User.active_user_count() == 2
|
||||
assert User.active_user_count(6) == 3
|
||||
assert User.active_user_count(1) == 1
|
||||
assert User.active_user_count(180) == 3
|
||||
assert User.active_user_count(365) == 4
|
||||
assert User.active_user_count(1000) == 5
|
||||
end
|
||||
|
||||
describe "pins" do
|
||||
|
|
|
|||
|
|
@ -776,6 +776,20 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
assert Enum.member?(activities, activity_one)
|
||||
end
|
||||
|
||||
test "doesn't return activities from deactivated users" do
|
||||
_user = insert(:user)
|
||||
deactivated = insert(:user)
|
||||
active = insert(:user)
|
||||
{:ok, activity_one} = CommonAPI.post(deactivated, %{status: "hey!"})
|
||||
{:ok, activity_two} = CommonAPI.post(active, %{status: "yay!"})
|
||||
{:ok, _updated_user} = User.set_activation(deactivated, false)
|
||||
|
||||
activities = ActivityPub.fetch_activities([], %{})
|
||||
|
||||
refute Enum.member?(activities, activity_one)
|
||||
assert Enum.member?(activities, activity_two)
|
||||
end
|
||||
|
||||
test "always see your own posts even when they address people you block" do
|
||||
user = insert(:user)
|
||||
blockee = insert(:user)
|
||||
|
|
|
|||
|
|
@ -105,5 +105,37 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidatorTest do
|
|||
|
||||
assert attachment.mediaType == "image/jpeg"
|
||||
end
|
||||
|
||||
test "it transforms image dimentions to our internal format" do
|
||||
attachment = %{
|
||||
"type" => "Document",
|
||||
"name" => "Hello world",
|
||||
"url" => "https://media.example.tld/1.jpg",
|
||||
"width" => 880,
|
||||
"height" => 960,
|
||||
"mediaType" => "image/jpeg",
|
||||
"blurhash" => "eTKL26+HDjcEIBVl;ds+K6t301W.t7nit7y1E,R:v}ai4nXSt7V@of"
|
||||
}
|
||||
|
||||
expected = %AttachmentValidator{
|
||||
type: "Document",
|
||||
name: "Hello world",
|
||||
mediaType: "image/jpeg",
|
||||
blurhash: "eTKL26+HDjcEIBVl;ds+K6t301W.t7nit7y1E,R:v}ai4nXSt7V@of",
|
||||
url: [
|
||||
%AttachmentValidator.UrlObjectValidator{
|
||||
type: "Link",
|
||||
mediaType: "image/jpeg",
|
||||
href: "https://media.example.tld/1.jpg",
|
||||
width: 880,
|
||||
height: 960
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{:ok, ^expected} =
|
||||
AttachmentValidator.cast_and_validate(attachment)
|
||||
|> Ecto.Changeset.apply_action(:insert)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.VideoHandlingTest do
|
|||
"href" =>
|
||||
"https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
|
||||
"mediaType" => "video/mp4",
|
||||
"type" => "Link"
|
||||
"type" => "Link",
|
||||
"width" => 480
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -79,7 +80,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.VideoHandlingTest do
|
|||
"href" =>
|
||||
"https://framatube.org/static/webseed/6050732a-8a7a-43d4-a6cd-809525a1d206-1080.mp4",
|
||||
"mediaType" => "video/mp4",
|
||||
"type" => "Link"
|
||||
"type" => "Link",
|
||||
"height" => 1080
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -107,7 +109,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.VideoHandlingTest do
|
|||
"href" =>
|
||||
"https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-1080-fragmented.mp4",
|
||||
"mediaType" => "video/mp4",
|
||||
"type" => "Link"
|
||||
"type" => "Link",
|
||||
"height" => 1080
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -524,4 +524,44 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "fix_attachments/1" do
|
||||
test "puts dimensions into attachment url field" do
|
||||
object = %{
|
||||
"attachment" => [
|
||||
%{
|
||||
"type" => "Document",
|
||||
"name" => "Hello world",
|
||||
"url" => "https://media.example.tld/1.jpg",
|
||||
"width" => 880,
|
||||
"height" => 960,
|
||||
"mediaType" => "image/jpeg",
|
||||
"blurhash" => "eTKL26+HDjcEIBVl;ds+K6t301W.t7nit7y1E,R:v}ai4nXSt7V@of"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
expected = %{
|
||||
"attachment" => [
|
||||
%{
|
||||
"type" => "Document",
|
||||
"name" => "Hello world",
|
||||
"url" => [
|
||||
%{
|
||||
"type" => "Link",
|
||||
"mediaType" => "image/jpeg",
|
||||
"href" => "https://media.example.tld/1.jpg",
|
||||
"width" => 880,
|
||||
"height" => 960
|
||||
}
|
||||
],
|
||||
"mediaType" => "image/jpeg",
|
||||
"blurhash" => "eTKL26+HDjcEIBVl;ds+K6t301W.t7nit7y1E,R:v}ai4nXSt7V@of"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
assert Transmogrifier.fix_attachments(object) == expected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -873,6 +873,56 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
"@#{admin.nickname} approved users: @#{user_one.nickname}, @#{user_two.nickname}"
|
||||
end
|
||||
|
||||
test "PATCH /api/pleroma/admin/users/suggest", %{admin: admin, conn: conn} do
|
||||
user1 = insert(:user, is_suggested: false)
|
||||
user2 = insert(:user, is_suggested: false)
|
||||
|
||||
response =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> patch(
|
||||
"/api/pleroma/admin/users/suggest",
|
||||
%{nicknames: [user1.nickname, user2.nickname]}
|
||||
)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert Enum.map(response["users"], & &1["is_suggested"]) == [true, true]
|
||||
[user1, user2] = Repo.reload!([user1, user2])
|
||||
|
||||
assert user1.is_suggested
|
||||
assert user2.is_suggested
|
||||
|
||||
log_entry = Repo.one(ModerationLog)
|
||||
|
||||
assert ModerationLog.get_log_entry_message(log_entry) ==
|
||||
"@#{admin.nickname} added suggested users: @#{user1.nickname}, @#{user2.nickname}"
|
||||
end
|
||||
|
||||
test "PATCH /api/pleroma/admin/users/unsuggest", %{admin: admin, conn: conn} do
|
||||
user1 = insert(:user, is_suggested: true)
|
||||
user2 = insert(:user, is_suggested: true)
|
||||
|
||||
response =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> patch(
|
||||
"/api/pleroma/admin/users/unsuggest",
|
||||
%{nicknames: [user1.nickname, user2.nickname]}
|
||||
)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert Enum.map(response["users"], & &1["is_suggested"]) == [false, false]
|
||||
[user1, user2] = Repo.reload!([user1, user2])
|
||||
|
||||
refute user1.is_suggested
|
||||
refute user2.is_suggested
|
||||
|
||||
log_entry = Repo.one(ModerationLog)
|
||||
|
||||
assert ModerationLog.get_log_entry_message(log_entry) ==
|
||||
"@#{admin.nickname} removed suggested users: @#{user1.nickname}, @#{user2.nickname}"
|
||||
end
|
||||
|
||||
test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admin, conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
|
|
@ -906,6 +956,7 @@ defmodule Pleroma.Web.AdminAPI.UserControllerTest do
|
|||
"display_name" => HTML.strip_tags(user.name || user.nickname),
|
||||
"is_confirmed" => true,
|
||||
"is_approved" => true,
|
||||
"is_suggested" => false,
|
||||
"url" => user.ap_id,
|
||||
"registration_reason" => nil,
|
||||
"actor_type" => "Person",
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@
|
|||
|
||||
defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
|
||||
use Pleroma.Web.ConnCase, async: true
|
||||
alias Pleroma.UserRelationship
|
||||
alias Pleroma.Web.CommonAPI
|
||||
import Pleroma.Factory
|
||||
|
||||
setup do: oauth_access(["read"])
|
||||
setup do: oauth_access(["read", "write"])
|
||||
|
||||
test "returns empty result", %{conn: conn} do
|
||||
res =
|
||||
|
|
@ -15,4 +18,66 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
|
|||
|
||||
assert res == []
|
||||
end
|
||||
|
||||
test "returns v2 suggestions", %{conn: conn} do
|
||||
%{id: user_id} = insert(:user, is_suggested: true)
|
||||
|
||||
res =
|
||||
conn
|
||||
|> get("/api/v2/suggestions")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [%{"source" => "staff", "account" => %{"id" => ^user_id}}] = res
|
||||
end
|
||||
|
||||
test "returns v2 suggestions excluding dismissed accounts", %{conn: conn} do
|
||||
%{id: user_id} = insert(:user, is_suggested: true)
|
||||
|
||||
conn
|
||||
|> delete("/api/v1/suggestions/#{user_id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
res =
|
||||
conn
|
||||
|> get("/api/v2/suggestions")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [] = res
|
||||
end
|
||||
|
||||
test "returns v2 suggestions excluding blocked accounts", %{conn: conn, user: blocker} do
|
||||
blocked = insert(:user, is_suggested: true)
|
||||
{:ok, _} = CommonAPI.block(blocker, blocked)
|
||||
|
||||
res =
|
||||
conn
|
||||
|> get("/api/v2/suggestions")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [] = res
|
||||
end
|
||||
|
||||
test "returns v2 suggestions excluding followed accounts", %{conn: conn, user: follower} do
|
||||
followed = insert(:user, is_suggested: true)
|
||||
{:ok, _, _, _} = CommonAPI.follow(follower, followed)
|
||||
|
||||
res =
|
||||
conn
|
||||
|> get("/api/v2/suggestions")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [] = res
|
||||
end
|
||||
|
||||
test "dismiss suggestion", %{conn: conn, user: source} do
|
||||
target = insert(:user, is_suggested: true)
|
||||
|
||||
res =
|
||||
conn
|
||||
|> delete("/api/v1/suggestions/#{target.id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert res == %{}
|
||||
assert UserRelationship.exists?(:suggestion_dismiss, source, target)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
tags: [],
|
||||
is_admin: false,
|
||||
is_moderator: false,
|
||||
is_suggested: false,
|
||||
hide_favorites: true,
|
||||
hide_followers: false,
|
||||
hide_follows: false,
|
||||
|
|
@ -183,6 +184,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
|
|||
tags: [],
|
||||
is_admin: false,
|
||||
is_moderator: false,
|
||||
is_suggested: false,
|
||||
hide_favorites: true,
|
||||
hide_followers: false,
|
||||
hide_follows: false,
|
||||
|
|
|
|||
34
test/pleroma/web/mastodon_api/views/suggestion_view_test.exs
Normal file
34
test/pleroma/web/mastodon_api/views/suggestion_view_test.exs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.MastodonAPI.SuggestionViewTest do
|
||||
use Pleroma.DataCase, async: true
|
||||
import Pleroma.Factory
|
||||
alias Pleroma.Web.MastodonAPI.SuggestionView, as: View
|
||||
|
||||
test "show.json" do
|
||||
user = insert(:user, is_suggested: true)
|
||||
json = View.render("show.json", %{user: user, source: :staff, skip_visibility_check: true})
|
||||
|
||||
assert json.source == :staff
|
||||
assert json.account.id == user.id
|
||||
end
|
||||
|
||||
test "index.json" do
|
||||
user1 = insert(:user, is_suggested: true)
|
||||
user2 = insert(:user, is_suggested: true)
|
||||
user3 = insert(:user, is_suggested: true)
|
||||
|
||||
[suggestion1, suggestion2, suggestion3] =
|
||||
View.render("index.json", %{
|
||||
users: [user1, user2, user3],
|
||||
source: :staff,
|
||||
skip_visibility_check: true
|
||||
})
|
||||
|
||||
assert suggestion1.source == :staff
|
||||
assert suggestion2.account.id == user2.id
|
||||
assert suggestion3.account.url == user3.ap_id
|
||||
end
|
||||
end
|
||||
|
|
@ -95,6 +95,7 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do
|
|||
".well-known",
|
||||
"nodeinfo",
|
||||
"manifest.json",
|
||||
"auth",
|
||||
"proxy",
|
||||
"test",
|
||||
"user_exists",
|
||||
|
|
|
|||
|
|
@ -5,10 +5,14 @@
|
|||
defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do
|
||||
use Pleroma.Web.ConnCase
|
||||
|
||||
alias Pleroma.Config
|
||||
alias Pleroma.PasswordResetToken
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.Tests.ObanHelpers
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.OAuth.Token
|
||||
import Pleroma.Factory
|
||||
import Swoosh.TestAssertions
|
||||
|
||||
describe "GET /api/pleroma/password_reset/token" do
|
||||
test "it returns error when token invalid", %{conn: conn} do
|
||||
|
|
@ -116,4 +120,94 @@ defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do
|
|||
assert User.get_by_id(user.id).password_reset_pending == false
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /auth/password, with valid parameters" do
|
||||
setup %{conn: conn} do
|
||||
user = insert(:user)
|
||||
conn = post(conn, "/auth/password?email=#{user.email}")
|
||||
%{conn: conn, user: user}
|
||||
end
|
||||
|
||||
test "it returns 204", %{conn: conn} do
|
||||
assert empty_json_response(conn)
|
||||
end
|
||||
|
||||
test "it creates a PasswordResetToken record for user", %{user: user} do
|
||||
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
|
||||
assert token_record
|
||||
end
|
||||
|
||||
test "it sends an email to user", %{user: user} do
|
||||
ObanHelpers.perform_all()
|
||||
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
|
||||
|
||||
email = Pleroma.Emails.UserEmail.password_reset_email(user, token_record.token)
|
||||
notify_email = Config.get([:instance, :notify_email])
|
||||
instance_name = Config.get([:instance, :name])
|
||||
|
||||
assert_email_sent(
|
||||
from: {instance_name, notify_email},
|
||||
to: {user.name, user.email},
|
||||
html_body: email.html_body
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /auth/password, with nickname" do
|
||||
test "it returns 204", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
|
||||
assert conn
|
||||
|> post("/auth/password?nickname=#{user.nickname}")
|
||||
|> empty_json_response()
|
||||
|
||||
ObanHelpers.perform_all()
|
||||
token_record = Repo.get_by(Pleroma.PasswordResetToken, user_id: user.id)
|
||||
|
||||
email = Pleroma.Emails.UserEmail.password_reset_email(user, token_record.token)
|
||||
notify_email = Config.get([:instance, :notify_email])
|
||||
instance_name = Config.get([:instance, :name])
|
||||
|
||||
assert_email_sent(
|
||||
from: {instance_name, notify_email},
|
||||
to: {user.name, user.email},
|
||||
html_body: email.html_body
|
||||
)
|
||||
end
|
||||
|
||||
test "it doesn't fail when a user has no email", %{conn: conn} do
|
||||
user = insert(:user, %{email: nil})
|
||||
|
||||
assert conn
|
||||
|> post("/auth/password?nickname=#{user.nickname}")
|
||||
|> empty_json_response()
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /auth/password, with invalid parameters" do
|
||||
setup do
|
||||
user = insert(:user)
|
||||
{:ok, user: user}
|
||||
end
|
||||
|
||||
test "it returns 204 when user is not found", %{conn: conn, user: user} do
|
||||
conn = post(conn, "/auth/password?email=nonexisting_#{user.email}")
|
||||
|
||||
assert empty_json_response(conn)
|
||||
end
|
||||
|
||||
test "it returns 204 when user is not local", %{conn: conn, user: user} do
|
||||
{:ok, user} = Repo.update(Ecto.Changeset.change(user, local: false))
|
||||
conn = post(conn, "/auth/password?email=#{user.email}")
|
||||
|
||||
assert empty_json_response(conn)
|
||||
end
|
||||
|
||||
test "it returns 204 when user is deactivated", %{conn: conn, user: user} do
|
||||
{:ok, user} = Repo.update(Ecto.Changeset.change(user, is_active: false, local: true))
|
||||
conn = post(conn, "/auth/password?email=#{user.email}")
|
||||
|
||||
assert empty_json_response(conn)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -473,7 +473,10 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
|
|||
|
||||
test "with proper permissions and wrong or missing password", %{conn: conn} do
|
||||
for params <- [%{"password" => "hi"}, %{}] do
|
||||
ret_conn = post(conn, "/api/pleroma/delete_account", params)
|
||||
ret_conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/pleroma/delete_account", params)
|
||||
|
||||
assert json_response_and_validate_schema(ret_conn, 200) == %{
|
||||
"error" => "Invalid password."
|
||||
|
|
@ -481,8 +484,28 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do
|
|||
end
|
||||
end
|
||||
|
||||
test "with proper permissions and valid password", %{conn: conn, user: user} do
|
||||
conn = post(conn, "/api/pleroma/delete_account?password=test")
|
||||
test "with proper permissions and valid password (URL query)", %{conn: conn, user: user} do
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/pleroma/delete_account?password=test")
|
||||
|
||||
ObanHelpers.perform_all()
|
||||
assert json_response_and_validate_schema(conn, 200) == %{"status" => "success"}
|
||||
|
||||
user = User.get_by_id(user.id)
|
||||
refute user.is_active
|
||||
assert user.name == nil
|
||||
assert user.bio == ""
|
||||
assert user.password_hash == nil
|
||||
end
|
||||
|
||||
test "with proper permissions and valid password (JSON body)", %{conn: conn, user: user} do
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/pleroma/delete_account", %{password: "test"})
|
||||
|
||||
ObanHelpers.perform_all()
|
||||
assert json_response_and_validate_schema(conn, 200) == %{"status" => "success"}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue