defmodule Arvore.Graphql.Reader.AccountMutationQueryTest do use Arvore.Web.ConnCase alias Arvore.Repo alias Arvore.Accounts.User alias Arvore.GraphQL.UserSchema test "should log with their credentials and receive a jwt back", info do %User{ email: "test@gmail.com", username: "test", encrypted_password: "$2a$10$LVa1Lc0P343lFuby.e.F2eAkRjlMUPB3xVQdggXcfg5Smb0jvxTJq" } # 12345678 |> Repo.insert {:ok, result} = login_mutation |> Absinthe.run(UserSchema, variables: %{"login" => "test@gmail.com", "password" => "12345678"}) assert get_in(result, [:data, "login", "token"]) != nil end def login_mutation do """ mutation UserLogin($login: String, $password: String) { login(login: $login, password: $password) { token } } """ end end