parsing Swoosh modules
authorAlexander Strizhakov <alex.strizhakov@gmail.com>
Thu, 23 Jan 2020 15:21:29 +0000 (18:21 +0300)
committerAlexander Strizhakov <alex.strizhakov@gmail.com>
Thu, 23 Jan 2020 15:21:29 +0000 (18:21 +0300)
lib/pleroma/config/config_db.ex
test/config/config_db_test.exs

index 91a1aa0cc2cf3781bf0b759ed2382418bea8a492..be66880951b57cefcfed87564f5c4b6f9abf5923 100644 (file)
@@ -416,7 +416,7 @@ defmodule Pleroma.ConfigDB do
 
   @spec is_module_name?(String.t()) :: boolean()
   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"]
   end
 end
index 61a0b1d5d5e5cf734049b60ef3119910dc626335..812709fd87b029c87c3d84f5a00b3029135ca3a4 100644 (file)
@@ -307,6 +307,15 @@ defmodule Pleroma.ConfigDBTest do
       assert ConfigDB.from_binary(binary) == Quack.Logger
     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
       binary = ConfigDB.transform("~r[comp[lL][aA][iI][nN]er]")
       assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)