From 4016aa77cc64bcf729093555843ff4eb80924a9d Mon Sep 17 00:00:00 2001 From: Nathan Schneider Date: Tue, 3 Aug 2021 16:51:12 -0600 Subject: [PATCH] Success using nested functions for requests on CLI --- modpol/tests/nested_functions.lua | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/modpol/tests/nested_functions.lua b/modpol/tests/nested_functions.lua index 378cb42..74106fc 100644 --- a/modpol/tests/nested_functions.lua +++ b/modpol/tests/nested_functions.lua @@ -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