blob: f16cbb6558d7f31faa9bd9800cf17cfe202ed2f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# frozen_string_literal: true
require 'test_helper'
class DNSBLTest < ActiveSupport::TestCase
ip = '127.0.0.2'
test 'low-risk addresses should not see anything' do
assert_not Dnsbl.high_risk?('3.3.3.3')
end
# FIXME: this test never worked
#test 'high-risk addresses should be told to contact an administrator' do
#assert_includes DNSBL.high_risk?(ip), "you're connecting from a high-risk IP address"
#end
test 'Tor users should be considered high risk' do
assert_includes Dnsbl.high_risk?('127.0.0.1'), 'Welcome, Tor hidden service user'
end
test 'registered users should not be considered high-risk' do
assert_not Dnsbl.high_risk?(ip, build(:user))
end
end
|