summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-01-15 17:32:15 -0500
committerMark Felder <feld@feld.me>2024-01-15 17:32:15 -0500
commit8bd8ee03c23bf1d318f67215195a1aca7465e3ae (patch)
tree0d20a6252d1fdcb47de5086c0d9fb6e4c799dede /test
parent4cbf11d32c9c37f3175e4d7bab04be64a9fe27d4 (diff)
Add Pleroma.Test.Helpers.get_query_parameter/2 to retrieve specific query parameter values
Diffstat (limited to 'test')
-rw-r--r--test/support/helpers.ex11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/support/helpers.ex b/test/support/helpers.ex
index bcdc49e4f..7fa6c31a4 100644
--- a/test/support/helpers.ex
+++ b/test/support/helpers.ex
@@ -32,6 +32,17 @@ defmodule Pleroma.Tests.Helpers do
|> URI.to_string()
end
+ @doc "Returns the value of the specified query parameter for the provided URL"
+ def get_query_parameter(url, param) do
+ url
+ |> URI.parse()
+ |> Map.get(:query)
+ |> URI.query_decoder()
+ |> Enum.to_list()
+ |> Enum.into(%{}, fn {x, y} -> {x, y} end)
+ |> Map.get(param)
+ end
+
defmacro clear_config(config_path) do
quote do
clear_config(unquote(config_path)) do