aboutsummaryrefslogtreecommitdiff
path: root/src/guff/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff/api')
-rw-r--r--src/guff/api/test.cr41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/guff/api/test.cr b/src/guff/api/test.cr
index 79d2d2e..71d614a 100644
--- a/src/guff/api/test.cr
+++ b/src/guff/api/test.cr
@@ -76,6 +76,47 @@ module Guff
)
raise "some random error"
end
+
+ private def do_test_add_user(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ user_id = @models.user.add_user(args["name"])
+ { "ok": true, "user_id": user_id }
+ end
+
+ private def do_test_update_user(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ @models.user.update_user(args["user_id"].to_i,
+ name: args["name"]? ? args["name"] : nil,
+ active: args["active"]? ? args["active"] == "t" : nil,
+ role: args["role"]? ? args["role"] : nil
+ )
+
+ { "ok": true }
+ end
+
+ private def do_test_add_login(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ @models.user.add_login(args["user_id"].to_i,
+ email: args["name"],
+ password: args["password"],
+ )
+
+ { "ok": true }
+ end
+
+ private def do_test_remove_login(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ @models.user.remove_login(args["user_id"].to_i)
+ { "ok": true }
+ end
end
end
end