Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node field type [uid] doesn't work through Repo #83

Open
mangr3n opened this issue Jun 17, 2020 · 0 comments
Open

Node field type [uid] doesn't work through Repo #83

mangr3n opened this issue Jun 17, 2020 · 0 comments

Comments

@mangr3n
Copy link

mangr3n commented Jun 17, 2020

Maybe I'm not understanding how this is supposed to work, but this doesn't work

test "setting uid fields" do
  user = %User{name: "George", age: 52}
  assert {:ok, %User{uid: uid}} = TestRepo.set(user)

  friend = %User{name: "David", age: 48, friends: [uid]}
  assert {:ok, %User{uid: new_uid}} = TestRepo.set(friend)
end

test "setting uid fields in changeset" do
  changeset = Ecto.Changeset.cast(%User{}, %{name: "George", age: 52}, [:name, :age])
  assert {:ok, %User{uid: uid}} = TestRepo.set(changeset)


  friendset = Ecto.Changeset.cast(%User{}, %{name: "David", age: 48, friends: [uid]}, [:name, :age, :friends])
  assert {:ok, %User{uid: new_uid}} = TestRepo.set(friendset)
end

Errors:

  1. test schema operations setting uid fields (Dlex.RepoTest)
    test/dlex/repo_test.exs:39
    match (=) failed
    code: assert {:ok, %User{uid: new_uid}} = TestRepo.set(friend)
    left: {:ok, %Dlex.User{uid: new_uid}}
    right: {:error, %Dlex.Error{exception: true, action: :execute, reason: %GRPC.RPCError{message: "Input for predicate "user.friends" of type uid is scalar. Edge: entity:11063 attr:"user.friends" value:"0x2b36" value_type:STRING ", status: 2}}}
    stacktrace:
    test/dlex/repo_test.exs:44: (test)

  2. test schema operations setting uid fields (Dlex.RepoTest)
    test/dlex/repo_test.exs:39
    match (=) failed
    code: assert {:ok, %User{uid: new_uid}} = TestRepo.set(friend)
    left: {:ok, %Dlex.User{uid: new_uid}}
    right: {:error, %Dlex.Error{exception: true, action: :execute, reason: %GRPC.RPCError{message: "Input for predicate "user.friends" of type uid is scalar. Edge: entity:11092 attr:"user.friends" value:"0x2b53" value_type:STRING ", status: 2}}}
    stacktrace:
    test/dlex/repo_test.exs:44: (test)

@mangr3n mangr3n changed the title [uid] doesn't work? Node field type [uid] doesn't work through Repo Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant