aboutsummaryrefslogtreecommitdiff
path: root/test/pleroma/web/twitter_api
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-12-21 12:21:40 +0100
committerlain <lain@soykaf.club>2020-12-21 12:21:40 +0100
commit9ba60f70d2076017b610708691f9b88a025c6d97 (patch)
treeac80e0aefe6157228323ed5fc8396426df292528 /test/pleroma/web/twitter_api
parentc9d73af74dc816dac484f1be2e842baac6fdaa6c (diff)
downloadpleroma-9ba60f70d2076017b610708691f9b88a025c6d97.tar.gz
Tests: Make as many tests as possible async.
In general, tests that match these criteria can be made async: - Doesn't use real Cachex. - Doesn't write to the Config / Application Environment. - Uses Mock. Using Mox is fine. - Uses the streamer.
Diffstat (limited to 'test/pleroma/web/twitter_api')
-rw-r--r--test/pleroma/web/twitter_api/controller_test.exs14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/pleroma/web/twitter_api/controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs
index 464d0ea2e..b3ca67637 100644
--- a/test/pleroma/web/twitter_api/controller_test.exs
+++ b/test/pleroma/web/twitter_api/controller_test.exs
@@ -3,11 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.TwitterAPI.ControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
- alias Pleroma.Builders.ActivityBuilder
alias Pleroma.Repo
alias Pleroma.User
+ alias Pleroma.Web.CommonAPI
alias Pleroma.Web.OAuth.Token
import Pleroma.Factory
@@ -36,22 +36,20 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
other_user = insert(:user)
{:ok, _activity} =
- ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user})
+ CommonAPI.post(other_user, %{
+ status: "Hey @#{current_user.nickname}"
+ })
response_conn =
conn
- |> assign(:user, current_user)
|> get("/api/v1/notifications")
- [notification] = response = json_response(response_conn, 200)
-
- assert length(response) == 1
+ [notification] = json_response(response_conn, 200)
assert notification["pleroma"]["is_seen"] == false
response_conn =
conn
- |> assign(:user, current_user)
|> post("/api/qvitter/statuses/notifications/read", %{"latest_id" => notification["id"]})
[notification] = response = json_response(response_conn, 200)