Skip to content

Commit

Permalink
Additional fields to test models for RPC delete tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carlgsmith committed Aug 1, 2024
1 parent 88a512c commit 869cc0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions models/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ local function set_age(input, path)
return true
end

local function delete_user(input, path)
local user = path:match('/t4:test/state/users/([^/]+)')
apteryx.prune("/t4:test/state/users/" .. user)
return true
end

return {
{ path="/operations/t4:reboot", methods={"POST"}, handler=reboot },
{ path="/operations/t4:get-reboot-info", methods={"GET", "POST"}, handler=get_reboot_info },
Expand All @@ -74,4 +80,5 @@ return {
{ path="/t4:test/state/get-last-reset-time", methods={"GET", "POST"}, handler=get_reset_time },
{ path="/t4:test/state/get-reset-history", methods={"GET", "POST"}, handler=get_reset_history },
{ path="/t4:test/state/users/*/set-age", methods={"POST"}, handler=set_age },
{ path="/t4:test/state/users/*", methods={"DELETE"}, handler=delete_user },
}
1 change: 1 addition & 0 deletions models/test4:rpc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<NODE name="*" help="The user entry with key name">
<NODE name="name" mode="rw" help="This is the name of the user"/>
<NODE name="age" mode="rw" help="Age of the user" range="0..4294967295"/>
<NODE name="_" mode="rwx" help="Delete a user"/>
<NODE name="set-age" mode="rwx" help="Set the users age">
<NODE name="input" help="Input parameters">
<NODE name="age" mode="w" help="New age" range="0..4294967295"/>
Expand Down

0 comments on commit 869cc0c

Please sign in to comment.