diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-12-10 08:55:14 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-12-10 08:55:14 +0300 |
commit | 835ac2157c53e8c85bd3759efe061dbfbdfc367e (patch) | |
tree | 266959488004bd33200c4ae4d664e665b77b2668 /test/support/helpers.ex | |
parent | 1770602747ae95d95d12c5601f99ced8699e8947 (diff) | |
parent | 99623b4eca8ad4af0b8e7adc9dd4765ba2922c8b (diff) | |
download | pleroma-835ac2157c53e8c85bd3759efe061dbfbdfc367e.tar.gz |
Merge remote-tracking branch 'remotes/upstream/develop' into 1427-oauth-admin-scopes
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'test/support/helpers.ex')
-rw-r--r-- | test/support/helpers.ex | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/support/helpers.ex b/test/support/helpers.ex index ce39dd9d8..af2b2eddf 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -75,6 +75,23 @@ defmodule Pleroma.Tests.Helpers do |> Poison.decode!() end + def stringify_keys(nil), do: nil + + def stringify_keys(key) when key in [true, false], do: key + def stringify_keys(key) when is_atom(key), do: Atom.to_string(key) + + def stringify_keys(map) when is_map(map) do + map + |> Enum.map(fn {k, v} -> {stringify_keys(k), stringify_keys(v)} end) + |> Enum.into(%{}) + end + + def stringify_keys([head | rest] = list) when is_list(list) do + [stringify_keys(head) | stringify_keys(rest)] + end + + def stringify_keys(key), do: key + defmacro guards_config(config_path) do quote do initial_setting = Pleroma.Config.get(config_path) |