forked from AkkomaGang/akkoma
parsing Swoosh modules
This commit is contained in:
parent
e8e57e398f
commit
6cd2e851d9
2 changed files with 10 additions and 1 deletions
|
@ -416,7 +416,7 @@ defp do_transform_string(value) do
|
||||||
|
|
||||||
@spec is_module_name?(String.t()) :: boolean()
|
@spec is_module_name?(String.t()) :: boolean()
|
||||||
def is_module_name?(string) do
|
def is_module_name?(string) do
|
||||||
Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth)\./, string) or
|
Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth|Swoosh)\./, string) or
|
||||||
string in ["Oban", "Ueberauth", "ExSyslogger"]
|
string in ["Oban", "Ueberauth", "ExSyslogger"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -307,6 +307,15 @@ test "Quack.Logger module" do
|
||||||
assert ConfigDB.from_binary(binary) == Quack.Logger
|
assert ConfigDB.from_binary(binary) == Quack.Logger
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "Swoosh.Adapters modules" do
|
||||||
|
binary = ConfigDB.transform("Swoosh.Adapters.SMTP")
|
||||||
|
assert binary == :erlang.term_to_binary(Swoosh.Adapters.SMTP)
|
||||||
|
assert ConfigDB.from_binary(binary) == Swoosh.Adapters.SMTP
|
||||||
|
binary = ConfigDB.transform("Swoosh.Adapters.AmazonSES")
|
||||||
|
assert binary == :erlang.term_to_binary(Swoosh.Adapters.AmazonSES)
|
||||||
|
assert ConfigDB.from_binary(binary) == Swoosh.Adapters.AmazonSES
|
||||||
|
end
|
||||||
|
|
||||||
test "sigil" do
|
test "sigil" do
|
||||||
binary = ConfigDB.transform("~r[comp[lL][aA][iI][nN]er]")
|
binary = ConfigDB.transform("~r[comp[lL][aA][iI][nN]er]")
|
||||||
assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)
|
assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)
|
||||||
|
|
Loading…
Reference in a new issue