3 class AclTest < ActiveSupport::TestCase
6 assert_predicate acl, :valid?
11 def test_no_account_creation_by_subnet
12 assert_not Acl.no_account_creation("192.168.1.1")
13 create(:acl, :address => "192.168.0.0/16", :k => "no_account_creation")
14 assert Acl.no_account_creation("192.168.1.1")
17 def test_no_account_creation_by_domain
18 assert_not Acl.no_account_creation("192.168.1.1", :domain => "example.com")
19 assert_not Acl.no_account_creation("192.168.1.1", :domain => "test.example.com")
20 create(:acl, :domain => "example.com", :k => "no_account_creation")
21 assert Acl.no_account_creation("192.168.1.1", :domain => "example.com")
22 assert Acl.no_account_creation("192.168.1.1", :domain => "test.example.com")
25 def test_no_account_creation_by_mx
26 assert_not Acl.no_account_creation("192.168.1.1", :mx => "mail.example.com")
27 create(:acl, :mx => "mail.example.com", :k => "no_account_creation")
28 assert Acl.no_account_creation("192.168.1.1", :mx => "mail.example.com")
31 def test_allowed_account_creation
32 assert_not Acl.allow_account_creation("192.168.1.1", :domain => "example.com", :mx => "mail.example.com")
33 create(:acl, :address => "192.168.1.1", :domain => "example.com", :mx => "mail.example.com", :k => "allow_account_creation")
35 assert_not Acl.allow_account_creation("192.168.1.2")
36 assert Acl.allow_account_creation("192.168.1.1")
38 assert_not Acl.allow_account_creation("192.168.1.2", :domain => "example.com", :mx => "mail.example.com")
39 assert_not Acl.allow_account_creation("192.168.1.1", :domain => "example1.com", :mx => "mail.example.com")
40 assert_not Acl.allow_account_creation("192.168.1.1", :domain => "example.com", :mx => "mail1.example.com")
41 assert Acl.allow_account_creation("192.168.1.1", :domain => "example.com", :mx => "mail.example.com")