浏览代码

added test fo Pleroma.Web.MastodonAPI.StatusController

merge-requests/1875/head
Maksim Pechnikov Ariadne Conill 4 年前
父节点
当前提交
9694d51437
共有 1 个文件被更改,包括 29 次插入0 次删除
  1. +29
    -0
      test/web/mastodon_api/controllers/status_controller_test.exs

+ 29
- 0
test/web/mastodon_api/controllers/status_controller_test.exs 查看文件

@@ -12,6 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.ScheduledActivity
alias Pleroma.Tests.ObanHelpers
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
@@ -29,6 +30,34 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
[conn: conn]
end

test "posting a status and checks reblog count after perform all backroud job", %{conn: conn} do
Pleroma.Config.put([:instance, :federating], true)
Pleroma.Config.get([:instance, :allow_relay], true)
user = insert(:user)

response =
conn
|> assign(:user, user)
|> post("api/v1/statuses", %{
"content_type" => "text/plain",
"source" => "Pleroma FE",
"status" => "Hello world",
"visibility" => "public"
})
|> json_response(200)

assert response["reblogs_count"] == 0
ObanHelpers.perform_all()

response =
conn
|> assign(:user, user)
|> get("api/v1/statuses/#{response["id"]}", %{})
|> json_response(200)

assert response["reblogs_count"] == 0
end

test "posting a status", %{conn: conn} do
idempotency_key = "Pikachu rocks!"



正在加载...
取消
保存