summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-11-20 16:26:43 +0100
committerlain <lain@soykaf.club>2020-11-20 16:26:43 +0100
commit9a1e5f5d48ef9f3b5a817c02dc8820aa99a6f693 (patch)
treec07748b60b4a6795dbfdb354af71f8e723505496 /test
parenta407e33c78121abf880f257d291f45ed28b55eeb (diff)
downloadpleroma-9a1e5f5d48ef9f3b5a817c02dc8820aa99a6f693.tar.gz
pleroma-9a1e5f5d48ef9f3b5a817c02dc8820aa99a6f693.zip
Search: Change search method based on detected pg version
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/activity/search_test.exs9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/pleroma/activity/search_test.exs b/test/pleroma/activity/search_test.exs
index 15591b726..37c0feeea 100644
--- a/test/pleroma/activity/search_test.exs
+++ b/test/pleroma/activity/search_test.exs
@@ -18,8 +18,9 @@ defmodule Pleroma.Activity.SearchTest do
assert result.id == post.id
end
- test "using plainto_tsquery" do
- clear_config([:instance, :search_function], :plain)
+ test "using plainto_tsquery on postgres < 11" do
+ old_config = Application.get_env(:postgres, :version)
+ Application.put_env(:postgres, :version, 10.0)
user = insert(:user)
{:ok, post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
@@ -29,11 +30,11 @@ defmodule Pleroma.Activity.SearchTest do
assert [result] = Search.search(nil, "wednesday -dudes")
assert result.id == post.id
+
+ Application.put_env(:postgres, :version, old_config)
end
test "using websearch_to_tsquery" do
- clear_config([:instance, :search_function], :websearch)
-
user = insert(:user)
{:ok, _post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
{:ok, other_post} = CommonAPI.post(user, %{status: "it's wednesday my bros"})