Renamed modpol/modpol directory to modpol_core for clarity and consistency

This commit is contained in:
Nathan Schneider
2021-12-18 14:50:41 -07:00
parent bd95fcf811
commit c2852b1bce
32 changed files with 6 additions and 8 deletions

View File

@ -0,0 +1,13 @@
dofile('../modpol.lua');
modpol.orgs.reset()
test_org = modpol.instance:add_org('test_org', 'luke')
test_org:add_member('nathan')
print(table.concat(test_org:list_members(), ", "))
test_org:call_module(
"join_org_consent",
"paul"
)

View File

@ -0,0 +1,15 @@
dofile('../modpol.lua');
modpol.orgs.reset()
test_org = modpol.instance:add_org('test_org', 'luke')
test_org:add_member('nathan')
print(table.concat(test_org:list_members(), ", "))
-- modpol.modules.join_org.initiate("paul", test_org)
test_org:call_module(
"join_org_class",
"paul"
)

View File

@ -0,0 +1,23 @@
dofile("../modpol.lua")
print('\nRemoving existing orgs')
modpol.orgs.reset()
print('\nCreating an org called "test_org"')
test_org = modpol.instance:add_org('test_org', 'luke')
print('\nTrying to create an org with the same name')
duplicate = modpol.instance:add_org('test_org', 'luke')
print('\nAdding user "nathan" to test_org')
test_org:add_member('nathan')
print('\nTrying to add duplicate user to test_org')
test_org:add_member('nathan')
print('\nRemoving user "nathan" from test_org')
test_org:remove_member('nathan')
print('\nTrying to remove user "nathan" from empty member list')
test_org:remove_member('nathan')

View File

@ -0,0 +1,53 @@
dofile('../modpol.lua');
modpol.orgs.reset()
test_org = modpol.instance:add_org('test_org', 'lukvmil')
test_org:add_member('luke')
test_org:add_member('nathan')
test_org:set_policy("add_member", "consent", false);
new_request = {
user = "josh",
type = "add_member",
params = {"josh"}
}
request_id = test_org:make_request(new_request)
-- process_id = test_org:create_process("consent", request_id)
for id, process in ipairs(test_org.processes) do
process:approve('luke', true)
process:approve('nathan', true)
end
-- process = test_org.processes[process_id]
-- process:approve("luke", true)
-- process:approve("nathan", true)
modpol.instance:set_policy("add_org", "consent", false);
new_request = {
user = "luke",
type = "add_org",
params = {"new_org"}
}
modpol.instance:add_member('luke')
modpol.instance:add_member('josh')
modpol.instance:add_member('nathan')
request_id = modpol.instance:make_request(new_request)
modpol.instance:make_request({
user="luke",
type="add_org",
params={"second_org"}
})
modpol.interactions.login()
for id, process in ipairs(modpol.instance.processes) do
-- process:approve('luke', true)
process:approve('josh', true)
end