Success using nested functions for requests on CLI

This commit is contained in:
Nathan Schneider 2021-08-03 16:51:12 -06:00
parent 82226f71b1
commit 4016aa77cc

View File

@ -9,16 +9,25 @@ test_org = modpol.instance:add_org('test_org', 'luke')
print('\nAdding user "nathan" to test_org')
test_org:add_member('nathan')
print('\nTrying to remove user "nathan" from empty member list')
test_org:remove_member('nathan')
print("\nOkay, let's start with requests. Setting up an org...")
modpol.instance:add_org('test_org', 'luke')
test_org:add_member('nathan')
print('\nInteractive test poll with nested functions...')
modpol.interactions.text_query(
"nathan","Poll question:",
function(input)
modpol.interactions.binary_poll_user(
"nathan", input,
function(response)
print("Poll successful!")
end)
end)
print('\nMaking consent the add_member policy')
test_org:set_policy("add_member", "consent", false);
print('\nMaking a request to add Josh')
add_josh = {
user = "josh",
type = "add_member",
params = {"josh"}
}
request_id = test_org:make_request(add_josh)
print('\nHave the two members vote on it')
modpol.interactions.org_dashboard("nathan","test_org")
modpol.interactions.org_dashboard("nathan","test_org")
-- check a member's dashboard for the process, try to initialize it