diff options
author | Steven Blowers <sblowers@findmypast.com> | 2016-11-01 12:42:12 +0000 |
---|---|---|
committer | Steven Blowers <sblowers@findmypast.com> | 2016-11-01 12:42:12 +0000 |
commit | dcd0050be5fc05d0460c5cc6508808ba8ab1cc7e (patch) | |
tree | d92e4b472411d41aa614e763799e0f53b3749dcf | |
parent | 74b69d7b91e8cf2711279228ad67f7abc20c00bb (diff) | |
download | zendex-dcd0050be5fc05d0460c5cc6508808ba8ab1cc7e.tar.gz zendex-dcd0050be5fc05d0460c5cc6508808ba8ab1cc7e.tar.xz |
adding exact return to in memory show user route
-rw-r--r-- | lib/http_client/in_memory.ex | 37 | ||||
-rw-r--r-- | test/zendex/user_test.exs | 37 |
2 files changed, 70 insertions, 4 deletions
diff --git a/lib/http_client/in_memory.ex b/lib/http_client/in_memory.ex index a448afd..46a53f5 100644 --- a/lib/http_client/in_memory.ex +++ b/lib/http_client/in_memory.ex @@ -26,9 +26,42 @@ defmodule Zendex.HttpClient.InMemory do fake_response("users") end - def get!("#{@base_url}/api/v2/users/87.json", + def get!("#{@base_url}/api/v2/users/295204.json", [{"Authorization", _authentication}]) do - fake_response(%{"user": %{"id": 87, "name": "Quim Stroud"}}) + fake_response(%{"user" => %{"ticket_restriction" => nil, + "chat_only" => false, + "shared_phone_number" => nil, + "notes" => "", + "phone" => nil, + "organization_id" => 11129520411, + "last_login_at" => "2016-10-28T21:08:23Z", + "moderator" => true, + "shared" => false, + "id" => 295204, + "role" => "admin", + "external_id" => nil, + "shared_agent" => false, + "photo" => nil, + "verified" => true, + "active" => true, + "locale_id" => 1, + "suspended" => false, + "created_at" => "2015-05-28T09:12:45Z", + "name" => "Nikolao Aikema", + "restricted_agent" => false, + "locale" => "en-US", + "details" => "", + "alias" => nil, + "url" => "https://test.zendesk.com/api/v2/users/295204.json", + "custom_role_id" => nil, + "email" => "nikolao.aikema@test.com", + "signature" => nil, + "two_factor_auth_enabled" => nil, + "time_zone" => "London", + "only_private_comments" => false, + "user_fields" => %{"customer_complaint" => nil}, + "tags" => [], + "updated_at" => "2016-10-28T21:08:23Z"}}) end def get!("#{@base_url}/api/v2/users/show_many.json?ids=6,67", diff --git a/test/zendex/user_test.exs b/test/zendex/user_test.exs index 2d9f04c..d6b99f6 100644 --- a/test/zendex/user_test.exs +++ b/test/zendex/user_test.exs @@ -13,8 +13,41 @@ defmodule Zendex.UserTest do end test "showing a user", context do - expected = %{"user" => %{"id" => 87, "name" => "Quim Stroud"}} - actual = Zendex.User.show(context[:conn], 87) + expected = %{"user" => %{"ticket_restriction" => nil, + "chat_only" => false, + "shared_phone_number" => nil, + "notes" => "", + "phone" => nil, + "organization_id" => 11129520411, + "last_login_at" => "2016-10-28T21:08:23Z", + "moderator" => true, + "shared" => false, + "id" => 295204, + "role" => "admin", + "external_id" => nil, + "shared_agent" => false, + "photo" => nil, + "verified" => true, + "active" => true, + "locale_id" => 1, + "suspended" => false, + "created_at" => "2015-05-28T09:12:45Z", + "name" => "Nikolao Aikema", + "restricted_agent" => false, + "locale" => "en-US", + "details" => "", + "alias" => nil, + "url" => "https://test.zendesk.com/api/v2/users/295204.json", + "custom_role_id" => nil, + "email" => "nikolao.aikema@test.com", + "signature" => nil, + "two_factor_auth_enabled" => nil, + "time_zone" => "London", + "only_private_comments" => false, + "user_fields" => %{"customer_complaint" => nil}, + "tags" => [], + "updated_at" => "2016-10-28T21:08:23Z"}} + actual = Zendex.User.show(context[:conn], 295204) assert expected == actual end |