Sha256: 1061cdfcc33ad36d4779e3479f8810a5bc4fdabe689901fbbccecff1ccbabd96

Contents?: true

Size: 814 Bytes

Versions: 5

Compression:

Stored size: 814 Bytes

Contents

#--
# Wmap
#
# A pure Ruby library for the Internet web application discovery and tracking.
#
# Copyright (c) 2012-2015 Yang Li <yang.li@owasp.org>
#++
# Unit Test File for Wmap::DomainTracker.instance class

require "minitest/autorun"
require "Wmap"

class CidrTrackerTest < MiniTest::Unit::TestCase
	include Wmap::Utils

	def test_cidr_add
		w = Wmap::CidrTracker.new
		w.add("192.168.1.0/24")
		assert_equal true, w.known_cidr_blks.key?("192.168.1.0/24")
	end

	def test_cidr_delete
		w = Wmap::CidrTracker.new
		w.add("10.0.0.0/8")
		w.delete("10.0.0.0/8")
		assert_equal false, w.known_cidr_blks.key?("10.0.0.0/8")
	end

	def test_ip_trusted?
		w = Wmap::CidrTracker.new
		w.add("192.168.1.0/24")
		assert_equal true, w.ip_trusted?("192.168.1.1")
		assert_equal true, w.ip_trusted?("192.168.1.255")
	end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wmap-2.8.4 test/cidr_tracker_test.rb
wmap-2.8.3 test/cidr_tracker_test.rb
wmap-2.8.2 test/cidr_tracker_test.rb
wmap-2.8.1 test/cidr_tracker_test.rb
wmap-2.7.9 test/cidr_tracker_test.rb