Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel-dms
This commit is contained in:
commit
ec7335535d
37 changed files with 326 additions and 164 deletions
|
|
@ -681,17 +681,17 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
|
|||
test "following / unfollowing errors", %{user: user, conn: conn} do
|
||||
# self follow
|
||||
conn_res = post(conn, "/api/v1/accounts/#{user.id}/follow")
|
||||
assert %{"error" => "Record not found"} = json_response(conn_res, 404)
|
||||
assert %{"error" => "Can not follow yourself"} = json_response(conn_res, 400)
|
||||
|
||||
# self unfollow
|
||||
user = User.get_cached_by_id(user.id)
|
||||
conn_res = post(conn, "/api/v1/accounts/#{user.id}/unfollow")
|
||||
assert %{"error" => "Record not found"} = json_response(conn_res, 404)
|
||||
assert %{"error" => "Can not unfollow yourself"} = json_response(conn_res, 400)
|
||||
|
||||
# self follow via uri
|
||||
user = User.get_cached_by_id(user.id)
|
||||
conn_res = post(conn, "/api/v1/follows", %{"uri" => user.nickname})
|
||||
assert %{"error" => "Record not found"} = json_response(conn_res, 404)
|
||||
assert %{"error" => "Can not follow yourself"} = json_response(conn_res, 400)
|
||||
|
||||
# follow non existing user
|
||||
conn_res = post(conn, "/api/v1/accounts/doesntexist/follow")
|
||||
|
|
|
|||
|
|
@ -302,6 +302,17 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
assert [] == Repo.all(Activity)
|
||||
end
|
||||
|
||||
test "ignores nil values", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, "/api/v1/statuses", %{
|
||||
"status" => "not scheduled",
|
||||
"scheduled_at" => nil
|
||||
})
|
||||
|
||||
assert result = json_response(conn, 200)
|
||||
assert Activity.get_by_id(result["id"])
|
||||
end
|
||||
|
||||
test "creates a scheduled activity with a media attachment", %{user: user, conn: conn} do
|
||||
scheduled_at = NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(120), :millisecond)
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
|
|||
%{title: "why are you even asking?", votes_count: 0}
|
||||
],
|
||||
voted: false,
|
||||
votes_count: 0
|
||||
votes_count: 0,
|
||||
voters_count: nil
|
||||
}
|
||||
|
||||
result = PollView.render("show.json", %{object: object})
|
||||
|
|
@ -69,9 +70,20 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
|
|||
}
|
||||
})
|
||||
|
||||
voter = insert(:user)
|
||||
|
||||
object = Object.normalize(activity)
|
||||
|
||||
assert %{multiple: true} = PollView.render("show.json", %{object: object})
|
||||
{:ok, _votes, object} = CommonAPI.vote(voter, object, [0, 1])
|
||||
|
||||
assert match?(
|
||||
%{
|
||||
multiple: true,
|
||||
voters_count: 1,
|
||||
votes_count: 2
|
||||
},
|
||||
PollView.render("show.json", %{object: object})
|
||||
)
|
||||
end
|
||||
|
||||
test "detects emoji" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue