Created
July 5, 2017 20:07
-
-
Save andrelip/74e6d4557589a9b07b7777d05f64ee0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: "[email protected]", username: "test", | |
| encrypted_password: "$2a$10$LVa1Lc0P343lFuby.e.F2eAkRjlMUPB3xVQdggXcfg5Smb0jvxTJq" } # 12345678 | |
| |> Repo.insert | |
| {:ok, result} = login_mutation | |
| |> Absinthe.run(UserSchema, | |
| variables: %{"login" => "[email protected]", | |
| "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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment