diff options
author | Roman Chvanikov <chvanikoff@gmail.com> | 2019-04-13 17:40:42 +0700 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@gmail.com> | 2019-04-13 17:40:42 +0700 |
commit | 371a4aed2ca9f6926e49f6791c8b4d14292d20e5 (patch) | |
tree | d4c945264c80b359fcd0bc6a21b5dd71cb885228 /test | |
parent | 30a4318ef15a912f9dfc0e8e206cbc6c10197709 (diff) | |
download | pleroma-371a4aed2ca9f6926e49f6791c8b4d14292d20e5.tar.gz pleroma-371a4aed2ca9f6926e49f6791c8b4d14292d20e5.zip |
Add User.Info.email_notifications
Diffstat (limited to 'test')
-rw-r--r-- | test/user_info_test.exs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/user_info_test.exs b/test/user_info_test.exs new file mode 100644 index 000000000..2d795594e --- /dev/null +++ b/test/user_info_test.exs @@ -0,0 +1,24 @@ +defmodule Pleroma.UserInfoTest do + alias Pleroma.Repo + alias Pleroma.User.Info + + use Pleroma.DataCase + + import Pleroma.Factory + + describe "update_email_notifications/2" do + setup do + user = insert(:user, %{info: %{email_notifications: %{"digest" => true}}}) + + {:ok, user: user} + end + + test "Notifications are updated", %{user: user} do + true = user.info.email_notifications["digest"] + changeset = Info.update_email_notifications(user.info, %{"digest" => false}) + assert changeset.valid? + {:ok, result} = Ecto.Changeset.apply_action(changeset, :insert) + assert result.email_notifications["digest"] == false + end + end +end |