Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
673B

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