Add User.Info.email_notifications
This commit is contained in:
parent
30a4318ef1
commit
371a4aed2c
3 changed files with 71 additions and 0 deletions
24
test/user_info_test.exs
Normal file
24
test/user_info_test.exs
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue