org_req_test.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 = "luke",
  24. type = "add_org",
  25. params = {"new_org"}
  26. }
  27. modpol.instance:add_member('luke')
  28. modpol.instance:add_member('josh')
  29. modpol.instance:add_member('nathan')
  30. request_id = modpol.instance:make_request(new_request)
  31. modpol.instance:make_request({
  32. user="luke",
  33. type="add_org",
  34. params={"second_org"}
  35. })
  36. modpol.interactions.login()
  37. for id, process in ipairs(modpol.instance.processes) do
  38. -- process:approve('luke', true)
  39. process:approve('josh', true)
  40. end