aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2016-06-15 19:20:27 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2016-06-15 19:23:55 +0200
commit7b308e0d41909e515ec42acfbd31167e7e4f617d (patch)
tree866008ae95231e08f774870de9502df4ee8eeba2 /test
parentCheck password with jid:resourceprep when registering account (#996) (diff)
Add shorter version of some common access rules definitions
This add conversion of - allow to - allow: all and - allow: acl_name to - allow: - acl: acl_name (this works also for deny, and number in shapers)
Diffstat (limited to 'test')
-rw-r--r--test/acl_test.exs25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/acl_test.exs b/test/acl_test.exs
index ab2ecb2a4..ccf518037 100644
--- a/test/acl_test.exs
+++ b/test/acl_test.exs
@@ -302,6 +302,31 @@ defmodule ACLTest do
assert :acl.access_matches(rules, %{usr: {"user1", "server11", "res1"}}, :global) == :deny
assert :acl.access_matches(rules, %{usr: {"user11", "server11", "res1"}}, :global) == :deny
end
+
+ test "transform_access_rules_config expands allow rule" do
+ assert :acl.transform_access_rules_config([:allow]) == [{:allow, [:all]}]
+ end
+
+ test "transform_access_rules_config expands deny rule" do
+ assert :acl.transform_access_rules_config([:deny]) == [{:deny, [:all]}]
+ end
+
+ test "transform_access_rules_config expands <integer> rule" do
+ assert :acl.transform_access_rules_config([100]) == [{100, [:all]}]
+ end
+
+ test "transform_access_rules_config expands allow: <acl_name> rule" do
+ assert :acl.transform_access_rules_config([{:allow, :test1}]) == [{:allow, [{:acl, :test1}]}]
+ end
+
+ test "transform_access_rules_config expands deny: <acl_name> rule" do
+ assert :acl.transform_access_rules_config([{:deny, :test1}]) == [{:deny, [{:acl, :test1}]}]
+ end
+
+ test "transform_access_rules_config expands integer: <acl_name> rule" do
+ assert :acl.transform_access_rules_config([{100, :test1}]) == [{100, [{:acl, :test1}]}]
+ end
+
## Checking ACL on both user pattern and IP
## ========================================