Skip to content
Permalink
Browse files

Fix bugs

  • Loading branch information...
danschultzer committed Aug 26, 2019
1 parent 33907ad commit 0060f3ad1004f0d03e5b5caaba7f17cd1a1ff123
@@ -113,7 +113,9 @@ defmodule PowAssent.Ecto.UserIdentities.ContextTest do
test "when other user has provider uid", %{user: user} do
_second_user =
%UserWithAccessTokenUserIdentities{}
|> Changeset.change(email: "test-2@example.com", user_identities: [@user_identity_params_with_access_token])
|> Changeset.change(email: "test-2@example.com")
|> Changeset.cast(%{user_identities: [@user_identity_params_with_access_token]}, [])
|> Changeset.cast_assoc(:user_identities)
|> Repo.insert!()

assert {:error, {:bound_to_different_user, _changeset}} = Context.upsert(user, @user_identity_params_with_access_token, @config_with_access_token)
@@ -14,7 +14,7 @@ defmodule PowAssent.Test.Ecto.UserIdentities.UserIdentityWithAccessToken do
end

def changeset(user_identity_or_changeset, attrs) do
token_params = Map.get(attrs, "token", attrs)
token_params = Map.get(attrs, "token") || Map.get(attrs, :token) || attrs

user_identity_or_changeset
|> pow_assent_changeset(attrs)

0 comments on commit 0060f3a

Please sign in to comment.
You can’t perform that action at this time.