forked from AkkomaGang/akkoma
update test for whole_word in filter
This commit is contained in:
parent
f341a8e142
commit
d6ab9f2132
1 changed files with 25 additions and 2 deletions
|
@ -64,11 +64,13 @@ test "fetching a list of filters" do
|
||||||
test "get a filter" do
|
test "get a filter" do
|
||||||
%{user: user, conn: conn} = oauth_access(["read:filters"])
|
%{user: user, conn: conn} = oauth_access(["read:filters"])
|
||||||
|
|
||||||
|
# check whole_word true
|
||||||
query = %Pleroma.Filter{
|
query = %Pleroma.Filter{
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
filter_id: 2,
|
filter_id: 2,
|
||||||
phrase: "knight",
|
phrase: "knight",
|
||||||
context: ["home"]
|
context: ["home"],
|
||||||
|
whole_word: false
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, filter} = Pleroma.Filter.create(query)
|
{:ok, filter} = Pleroma.Filter.create(query)
|
||||||
|
@ -76,6 +78,25 @@ test "get a filter" do
|
||||||
conn = get(conn, "/api/v1/filters/#{filter.filter_id}")
|
conn = get(conn, "/api/v1/filters/#{filter.filter_id}")
|
||||||
|
|
||||||
assert response = json_response_and_validate_schema(conn, 200)
|
assert response = json_response_and_validate_schema(conn, 200)
|
||||||
|
assert response["whole_word"] == false
|
||||||
|
|
||||||
|
# check whole_word false
|
||||||
|
%{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)
|
||||||
|
|
||||||
|
conn = get(conn, "/api/v1/filters/#{filter.filter_id}")
|
||||||
|
|
||||||
|
assert response = json_response_and_validate_schema(conn, 200)
|
||||||
|
assert response["whole_word"] == true
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update a filter" do
|
test "update a filter" do
|
||||||
|
@ -86,7 +107,8 @@ test "update a filter" do
|
||||||
filter_id: 2,
|
filter_id: 2,
|
||||||
phrase: "knight",
|
phrase: "knight",
|
||||||
context: ["home"],
|
context: ["home"],
|
||||||
hide: true
|
hide: true,
|
||||||
|
whole_word: true
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, _filter} = Pleroma.Filter.create(query)
|
{:ok, _filter} = Pleroma.Filter.create(query)
|
||||||
|
@ -108,6 +130,7 @@ test "update a filter" do
|
||||||
assert response["phrase"] == new.phrase
|
assert response["phrase"] == new.phrase
|
||||||
assert response["context"] == new.context
|
assert response["context"] == new.context
|
||||||
assert response["irreversible"] == true
|
assert response["irreversible"] == true
|
||||||
|
assert response["whole_word"] == true
|
||||||
end
|
end
|
||||||
|
|
||||||
test "delete a filter" do
|
test "delete a filter" do
|
||||||
|
|
Loading…
Reference in a new issue