org_req_test.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. dofile('../modpol.lua');
  2. modpol.orgs.reset()
  3. test_org = modpol.instance:add_org('test_org', 'lukvmil')
  4. test_org:add_member('luke')
  5. test_org:add_member('nathan')
  6. test_org:set_policy("add_member", "consent", false);
  7. new_request = {
  8. user = "josh",
  9. type = "add_member",
  10. params = {"josh"}
  11. }
  12. request_id = test_org:make_request(new_request)
  13. -- process_id = test_org:create_process("consent", request_id)
  14. for id, process in ipairs(test_org.processes) do
  15. process:approve('luke', true)
  16. process:approve('nathan', true)
  17. end
  18. -- process = test_org.processes[process_id]
  19. -- process:approve("luke", true)
  20. -- process:approve("nathan", true)
  21. modpol.instance:set_policy("add_org", "consent", false);
  22. new_request = {
  23. user = "lukvmil",
  24. type = "add_org",
  25. params = {"new_org"}
  26. }
  27. request_id = modpol.instance:make_request(new_request)
  28. modpol.instance:add_member('luke')
  29. modpol.instance:add_member('josh')
  30. modpol.instance:add_member('nathan')
  31. for id, process in ipairs(modpol.instance.processes) do
  32. process:approve('luke', true)
  33. process:approve('josh', true)
  34. end