Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. defmodule Arvore.Graphql.Reader.AccountMutationQueryTest do
  2. use Arvore.Web.ConnCase
  3. alias Arvore.Repo
  4. alias Arvore.Accounts.User
  5. alias Arvore.GraphQL.UserSchema
  6.  
  7. test "should log with their credentials and receive a jwt back", info do
  8. %User{ email: "test@gmail.com", username: "test",
  9. encrypted_password: "$2a$10$LVa1Lc0P343lFuby.e.F2eAkRjlMUPB3xVQdggXcfg5Smb0jvxTJq" } # 12345678
  10. |> Repo.insert
  11. {:ok, result} = login_mutation
  12. |> Absinthe.run(UserSchema,
  13. variables: %{"login" => "test@gmail.com",
  14. "password" => "12345678"})
  15. assert get_in(result, [:data, "login", "token"]) != nil
  16. end
  17.  
  18. def login_mutation do
  19. """
  20. mutation UserLogin($login: String, $password: String) {
  21. login(login: $login, password: $password) {
  22. token
  23. }
  24. }
  25. """
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement