logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

user_info_test.exs (673B)


      1 defmodule Pleroma.UserInfoTest do
      2   alias Pleroma.Repo
      3   alias Pleroma.User.Info
      4 
      5   use Pleroma.DataCase
      6 
      7   import Pleroma.Factory
      8 
      9   describe "update_email_notifications/2" do
     10     setup do
     11       user = insert(:user, %{info: %{email_notifications: %{"digest" => true}}})
     12 
     13       {:ok, user: user}
     14     end
     15 
     16     test "Notifications are updated", %{user: user} do
     17       true = user.info.email_notifications["digest"]
     18       changeset = Info.update_email_notifications(user.info, %{"digest" => false})
     19       assert changeset.valid?
     20       {:ok, result} = Ecto.Changeset.apply_action(changeset, :insert)
     21       assert result.email_notifications["digest"] == false
     22     end
     23   end
     24 end