forked from mirrors/akkoma
little fixes and typos fix
This commit is contained in:
parent
9c1f3bfeff
commit
0b02040327
|
@ -101,8 +101,8 @@
|
|||
%{
|
||||
key: :versions,
|
||||
type: {:list, :atom},
|
||||
descriptions: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
|
||||
description: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, ":tlsv1.1", ":tlsv1.2"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1509,8 +1509,8 @@
|
|||
%{
|
||||
key: :versions,
|
||||
type: {:list, :atom},
|
||||
descriptions: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
|
||||
description: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, ":tlsv1.1", ":tlsv1.2"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -2820,8 +2820,8 @@
|
|||
%{
|
||||
key: :versions,
|
||||
type: {:list, :atom},
|
||||
descriptions: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
|
||||
description: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, ":tlsv1.1", ":tlsv1.2"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -183,6 +183,11 @@ defp do_convert(entity) when is_tuple(entity),
|
|||
defp do_convert(entity) when is_boolean(entity) or is_number(entity) or is_nil(entity),
|
||||
do: entity
|
||||
|
||||
defp do_convert(entity)
|
||||
when is_atom(entity) and entity in [:"tlsv1.1", :"tlsv1.2", :"tlsv1.3"] do
|
||||
":#{to_string(entity)}"
|
||||
end
|
||||
|
||||
defp do_convert(entity) when is_atom(entity), do: inspect(entity)
|
||||
|
||||
defp do_convert(entity) when is_binary(entity), do: entity
|
||||
|
|
|
@ -85,6 +85,12 @@ defmodule Pleroma.Docs.GeneratorTest do
|
|||
key: "application/xml",
|
||||
type: {:list, :string},
|
||||
suggestions: ["xml"]
|
||||
},
|
||||
%{
|
||||
key: :versions,
|
||||
type: {:list, :atom},
|
||||
description: "List of TLS version to use",
|
||||
suggestions: [:tlsv1, ":tlsv1.1", ":tlsv1.2"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -208,6 +214,12 @@ test "key as string subchild" do
|
|||
assert child[:key] == "application/xml"
|
||||
end
|
||||
|
||||
test "suggestion for tls versions" do
|
||||
[%{children: children} | _] = Generator.convert_to_strings(@descriptions)
|
||||
child = Enum.at(children, 8)
|
||||
assert child[:suggestions] == [":tlsv1", ":tlsv1.1", ":tlsv1.2"]
|
||||
end
|
||||
|
||||
test "subgroup with module name" do
|
||||
[%{children: children} | _] = Generator.convert_to_strings(@descriptions)
|
||||
|
||||
|
|
|
@ -2204,6 +2204,47 @@ test "saving config with partial update", %{conn: conn} do
|
|||
}
|
||||
end
|
||||
|
||||
test "saving special atoms", %{conn: conn} do
|
||||
conn =
|
||||
post(conn, "/api/pleroma/admin/config", %{
|
||||
"configs" => [
|
||||
%{
|
||||
"group" => ":pleroma",
|
||||
"key" => ":key1",
|
||||
"value" => [
|
||||
%{
|
||||
"tuple" => [
|
||||
":ssl_options",
|
||||
[%{"tuple" => [":versions", [":tlsv1", ":tlsv1.1", ":tlsv1.2"]]}]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
assert json_response(conn, 200) == %{
|
||||
"configs" => [
|
||||
%{
|
||||
"group" => ":pleroma",
|
||||
"key" => ":key1",
|
||||
"value" => [
|
||||
%{
|
||||
"tuple" => [
|
||||
":ssl_options",
|
||||
[%{"tuple" => [":versions", [":tlsv1", ":tlsv1.1", ":tlsv1.2"]]}]
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
assert Application.get_env(:pleroma, :key1) == [
|
||||
ssl_options: [versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]]
|
||||
]
|
||||
end
|
||||
|
||||
test "saving full setting if value is in full_key_update list", %{conn: conn} do
|
||||
backends = Application.get_env(:logger, :backends)
|
||||
on_exit(fn -> Application.put_env(:logger, :backends, backends) end)
|
||||
|
|
|
@ -151,6 +151,12 @@ test "atom" do
|
|||
assert Config.from_binary(binary) == :atom
|
||||
end
|
||||
|
||||
test "ssl options" do
|
||||
binary = Config.transform([":tlsv1", ":tlsv1.1", ":tlsv1.2"])
|
||||
assert binary == :erlang.term_to_binary([:tlsv1, :"tlsv1.1", :"tlsv1.2"])
|
||||
assert Config.from_binary(binary) == [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
|
||||
end
|
||||
|
||||
test "pleroma module" do
|
||||
binary = Config.transform("Pleroma.Bookmark")
|
||||
assert binary == :erlang.term_to_binary(Pleroma.Bookmark)
|
||||
|
|
Loading…
Reference in a new issue