aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-08-06 08:35:39 +0000
committerlain <lain@soykaf.club>2020-08-06 08:35:39 +0000
commit10b0e55acffeeff5842421c12b3b26feb35336de (patch)
tree1c5cadd5c9c39d2c9196b73cd8ab57e167df04e6 /test
parent4b47d9c5b621c7c0ef4f2e2a010b323bf362895d (diff)
parentf785dba09bc6c6624c17350356632d008f701183 (diff)
downloadpleroma-10b0e55acffeeff5842421c12b3b26feb35336de.tar.gz
Merge branch 'whole-word-filter-hotfix' into 'develop'
Update filter_view.ex to return whole_word actual value See merge request pleroma/pleroma!2851
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/controllers/filter_controller_test.exs27
1 files changed, 25 insertions, 2 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