aboutsummaryrefslogtreecommitdiff
path: root/src/guff/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/guff/api')
-rw-r--r--src/guff/api/content-type.cr2
-rw-r--r--src/guff/api/methods.cr8
-rw-r--r--src/guff/api/test.cr38
3 files changed, 47 insertions, 1 deletions
diff --git a/src/guff/api/content-type.cr b/src/guff/api/content-type.cr
index 589e6b0..648ee3a 100644
--- a/src/guff/api/content-type.cr
+++ b/src/guff/api/content-type.cr
@@ -1,6 +1,6 @@
module Guff::API::ContentType
CONTENT_TYPES = {
- "development": "text/html; charset=utf-8",
+ "development": "text/json; charset=utf-8",
"production": "application/json; charset=utf8",
}
diff --git a/src/guff/api/methods.cr b/src/guff/api/methods.cr
index 9b35596..0247460 100644
--- a/src/guff/api/methods.cr
+++ b/src/guff/api/methods.cr
@@ -350,6 +350,14 @@ module Guff
"error": {
text: "Test error response",
},
+
+ "get_users": {
+ text: "Get mock list of users",
+ },
+
+ "set_user": {
+ text: "Set mock user",
+ },
}
}
diff --git a/src/guff/api/test.cr b/src/guff/api/test.cr
index 7549c11..44b5e10 100644
--- a/src/guff/api/test.cr
+++ b/src/guff/api/test.cr
@@ -17,6 +17,44 @@ module Guff
[{foo: "bar"}, {foo: "asdf"}].to_json
end
+ MOCK_USERS = {
+ "users": [{
+ "id": "0",
+ "name": "Guest",
+ "active": true,
+ }, {
+ "id": "1",
+ "name": "Admin",
+ "active": false,
+ }, {
+ "id": "2",
+ "name": "Test User 1",
+ "active": false,
+ }, {
+ "id": "2",
+ "name": "Test User 2",
+ "active": false,
+ }, {
+ "id": "3",
+ "name": "Test User<<<<>>>>>&&&&&&2",
+ "active": false,
+ }]
+ }
+
+ private def do_test_get_users(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ MOCK_USERS
+ end
+
+ private def do_test_set_user(
+ context : HTTP::Server::Context,
+ args : Hash(String, String)
+ )
+ { ok: true }
+ end
+
private def do_test_error(
context : HTTP::Server::Context,
args : Hash(String, String)