       assert %{"users" => users} = json_response(conn, 200)["data"]
       is_the_same_users(users, [admin])
     end
+
+    test "list should not be showed for unauthorized user", %{conn: conn} do
+      conn = get conn, user_path(conn, :index)
+      assert json_response(conn, 401)["errors"]
+    end
+  end
+
+  describe "show user" do
+    test "show user", %{conn: conn} do
+      t = Accounts.get_user_by_username("admin")
+      admin = %{"id" => t.id, "name" => t.name, "username" => t.username}
+      conn = Boilerplate.Accounts.sign_in_user(conn, t)
+      conn = get conn, user_path(conn, :show, t.id, %{"username" => "admin"})
+      assert user = json_response(conn, 200)["data"]
+      is_the_same_users(user, admin)
+    end
+
+    test "list should not be showed for unauthorized user", %{conn: conn} do
+      conn = get conn, user_path(conn, :show, 1, %{"username" => "admin"})
+      assert json_response(conn, 401)["errors"]
+    end
   end
 
   describe "create user" do

      assert response(conn, 404)
    end

    test "deletes chosen user when users are not the same", %{conn: conn, user: user} do
      {:ok, %User{} = user2} = Accounts.create_user(@create_attrs2)
      new_conn = Boilerplate.Accounts.sign_in_user(conn, user2)
      new_conn = delete new_conn, user_path(new_conn, :delete, user.id)


  alias Boilerplate.Accounts
  alias Boilerplate.Accounts.User

  @create_attrs %{name: "Test Name", email: "test@test.com", password: "password", username: "username"}
  @create_attrs2 %{name: "Test Name", email: "test2@test.com", password: "password", username: "username2"}
