diff options
author | Mickael Remond <mremond@process-one.net> | 2016-04-06 14:48:43 +0200 |
---|---|---|
committer | Mickael Remond <mremond@process-one.net> | 2016-04-06 18:13:08 +0200 |
commit | eb36440c2e5e805ed7e2bf833376105f92dfbccd (patch) | |
tree | 0e2a6c818a053f28cdf434bcd42b4e4732742efc | |
parent | Allow clearing all ACL and access rules (diff) |
Variant for user ACL test
-rw-r--r-- | test/acl_test.exs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/acl_test.exs b/test/acl_test.exs index 0aca9bce..663d3bb6 100644 --- a/test/acl_test.exs +++ b/test/acl_test.exs @@ -30,6 +30,10 @@ defmodule ACLTest do :ok = :acl.start end + setup do + :acl.clear + end + test "simple user access rule matches" do :acl.add(:global, :basic_acl_1, {:user, "test1"}) :acl.add_access(:global, :basic_rule_1, [{:basic_acl_1, :allow}]) @@ -38,5 +42,12 @@ defmodule ACLTest do # We match on user part only for local domain. As an implicit rule remote domain are not matched assert :acl.match_rule(:global, :basic_rule_1, :jid.from_string("test1@otherdomain")) == :deny assert :acl.match_rule(:global, :basic_rule_1, :jid.from_string("test11@domain1")) == :deny + + :acl.add(:global, :basic_acl_2, {:user, {"test2", "domain1"}}) + :acl.add_access(:global, :basic_rule_2, [{:basic_acl_2, :allow}]) + assert :acl.match_rule(:global, :basic_rule_2, :jid.from_string("test2@domain1")) == :allow + assert :acl.match_rule(:global, :basic_rule_2, :jid.from_string("test2@domain2")) == :deny + assert :acl.match_rule(:global, :basic_rule_2, :jid.from_string("test2@otherdomain")) == :deny end + end |