summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-08-06 15:22:20 +0200
committerlain <lain@soykaf.club>2020-08-06 15:22:20 +0200
commitbf95dfb240cff8c5a2f8a0930e5309a09ca00ba1 (patch)
tree3a0c81155e7ae38e27008a7c066e8bc03fb1b410 /test/web/mastodon_api
parent532d6f94aea5d4f53e846b8b77296f80a9ae68a0 (diff)
parent10b0e55acffeeff5842421c12b3b26feb35336de (diff)
downloadpleroma-bf95dfb240cff8c5a2f8a0930e5309a09ca00ba1.tar.gz
pleroma-bf95dfb240cff8c5a2f8a0930e5309a09ca00ba1.zip
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into frontend-bundles-downloads
Diffstat (limited to 'test/web/mastodon_api')
-rw-r--r--test/web/mastodon_api/controllers/filter_controller_test.exs27
-rw-r--r--test/web/mastodon_api/mastodon_api_test.exs3
2 files changed, 26 insertions, 4 deletions
diff --git a/test/web/mastodon_api/controllers/filter_controller_test.exs b/test/web/mastodon_api/controllers/filter_controller_test.exs
index f29547d13..0d426ec34 100644
--- a/test/web/mastodon_api/controllers/filter_controller_test.exs
+++ b/test/web/mastodon_api/controllers/filter_controller_test.exs
@@ -64,11 +64,31 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
test "get a filter" do
%{user: user, conn: conn} = oauth_access(["read:filters"])
+ # check whole_word false
query = %Pleroma.Filter{
user_id: user.id,
filter_id: 2,
phrase: "knight",
- context: ["home"]
+ context: ["home"],
+ whole_word: false
+ }
+
+ {:ok, filter} = Pleroma.Filter.create(query)
+
+ conn = get(conn, "/api/v1/filters/#{filter.filter_id}")
+
+ assert response = json_response_and_validate_schema(conn, 200)
+ assert response["whole_word"] == false
+
+ # check whole_word true
+ %{user: user, conn: conn} = oauth_access(["read:filters"])
+
+ query = %Pleroma.Filter{
+ user_id: user.id,
+ filter_id: 3,
+ phrase: "knight",
+ context: ["home"],
+ whole_word: true
}
{:ok, filter} = Pleroma.Filter.create(query)
@@ -76,6 +96,7 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
conn = get(conn, "/api/v1/filters/#{filter.filter_id}")
assert response = json_response_and_validate_schema(conn, 200)
+ assert response["whole_word"] == true
end
test "update a filter" do
@@ -86,7 +107,8 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
filter_id: 2,
phrase: "knight",
context: ["home"],
- hide: true
+ hide: true,
+ whole_word: true
}
{:ok, _filter} = Pleroma.Filter.create(query)
@@ -108,6 +130,7 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
assert response["phrase"] == new.phrase
assert response["context"] == new.context
assert response["irreversible"] == true
+ assert response["whole_word"] == true
end
test "delete a filter" do
diff --git a/test/web/mastodon_api/mastodon_api_test.exs b/test/web/mastodon_api/mastodon_api_test.exs
index c08be37d4..0c5a38bf6 100644
--- a/test/web/mastodon_api/mastodon_api_test.exs
+++ b/test/web/mastodon_api/mastodon_api_test.exs
@@ -17,8 +17,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPITest do
test "returns error when followed user is deactivated" do
follower = insert(:user)
user = insert(:user, local: true, deactivated: true)
- {:error, error} = MastodonAPI.follow(follower, user)
- assert error == :rejected
+ assert {:error, _error} = MastodonAPI.follow(follower, user)
end
test "following for user" do