]> git.openstreetmap.org Git - rails.git/blob - test/models/acl_test.rb
Remove unused banner images
[rails.git] / test / models / acl_test.rb
1 require "test_helper"
2
3 class AclTest < ActiveSupport::TestCase
4   def test_k_required
5     acl = create(:acl)
6     assert acl.valid?
7     acl.k = nil
8     assert_not acl.valid?
9   end
10
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")
15   end
16
17   def test_no_account_creation_by_domain
18     assert_not Acl.no_account_creation("192.168.1.1", :domain => "example.com")
19     create(:acl, :domain => "example.com", :k => "no_account_creation")
20     assert Acl.no_account_creation("192.168.1.1", :domain => "example.com")
21   end
22
23   def test_no_account_creation_by_mx
24     assert_not Acl.no_account_creation("192.168.1.1", :mx => "mail.example.com")
25     create(:acl, :mx => "mail.example.com", :k => "no_account_creation")
26     assert Acl.no_account_creation("192.168.1.1", :mx => "mail.example.com")
27   end
28 end