diff options
Diffstat (limited to 'src/guff/api/test.cr')
-rw-r--r-- | src/guff/api/test.cr | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/src/guff/api/test.cr b/src/guff/api/test.cr index 448cadf..decc5ec 100644 --- a/src/guff/api/test.cr +++ b/src/guff/api/test.cr @@ -15,45 +15,22 @@ module Guff::API::TestAPI [{foo: "bar"}, {foo: "asdf"}].to_json end - MOCK_USERS = [{ - "id": "0", - "name": "Guest", - "active": true, - }, { - "id": "1", - "name": "Admin", - "active": false, - }, { - "id": "2", - "name": "Test User 1", - "active": false, - }, { - "id": "3", - "name": "Test User 2", - "active": false, - }, { - "id": "4", - "name": "Test User<<<<>>>>>&&&&&&2", - "active": false, - }] - private def do_test_get_users( context : HTTP::Server::Context, args : Hash(String, String) ) - user_id = "0" + # get user_id + user_id = 0_i64 with_session(context) do |session| - user_id = session["user_id"]? || "0" + user_id = (session["user_id"]? || "0").to_i64 false end - # build result - users = MOCK_USERS.map { |row| - row.merge({ "active": (row["id"] == user_id) }) - } + # get users + users = @models.user.get_users # return result - { "users": users } + { "users": users, "user_id": user_id } end private def do_test_set_user( |