test: add tests for new User.html_filter_policy()
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 22 Sep 2018 03:01:01 +0000 (03:01 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 22 Sep 2018 03:02:05 +0000 (03:02 +0000)
test/user_test.exs

index 58fe6eedad8647f48c23960f275015bb70d99d11..4b0f0739ed682f0f7470d61c993cfa34ba53eed4 100644 (file)
@@ -526,4 +526,18 @@ defmodule Pleroma.UserTest do
 
     assert {:ok, %User{}} = User.insert_or_update_user(data)
   end
+
+  describe "per-user rich-text filtering" do
+    test "html_filter_policy returns nil when rich-text is enabled" do
+      user = insert(:user)
+
+      assert nil == User.html_filter_policy(user)
+    end
+
+    test "html_filter_policy returns TwitterText scrubber when rich-text is disabled" do
+      user = insert(:user, %{info: %{"no_rich_text" => true}})
+
+      assert Pleroma.HTML.Scrubber.TwitterText == User.html_filter_policy(user)
+    end
+  end
 end