Renamed modpol/modpol directory to modpol_core for clarity and consistency
This commit is contained in:
13
modpol_core/tests/nested_module_test.lua
Normal file
13
modpol_core/tests/nested_module_test.lua
Normal 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"
|
||||
)
|
15
modpol_core/tests/new_module_test.lua
Normal file
15
modpol_core/tests/new_module_test.lua
Normal 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"
|
||||
)
|
23
modpol_core/tests/org_basic_test.lua
Normal file
23
modpol_core/tests/org_basic_test.lua
Normal 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')
|
||||
|
53
modpol_core/tests/org_req_test.lua
Normal file
53
modpol_core/tests/org_req_test.lua
Normal 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
|
Reference in New Issue
Block a user