aboutsummaryrefslogtreecommitdiff
path: root/test/zendex/user_test.exs
blob: 3964aacec76565c193dc63b9e3bec61594b73b19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
defmodule Zendex.UserTest do
  use ExUnit.Case, async: true

  setup do
    [conn: Zendex.Connection.set_up("http://test.zendesk.com", "User1", "pass")]
  end

  test "list users", context do
    expected = "users"
    actual = Zendex.User.list(context[:conn])

    assert expected == actual
  end

  test "showing a user", context do
    expected = %{"user" => %{"id" => 87, "name" => "Quim Stroud"}}
    actual = Zendex.User.show(context[:conn], 87)

    assert expected == actual
  end

  test "creating a user", context do
    expected = %{"user" => %{"id" => 1234, "name" => "Roger", "email" => "roger@dodger.com"}}
    actual = Zendex.User.create(context[:conn], %{user: %{name: "Roger", email: "roger@dodger.com"}})

    assert expected == actual
  end
end