forked from weppos/whois
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs and fixtures for the arin adapter.
- Loading branch information
Showing
4 changed files
with
242 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# The following results may also be obtained via: | ||
# http://whois.arin.net/rest/nets;q=4.2.2.1?showDetails=true&showARIN=false&ext=netref2 | ||
# | ||
|
||
NetRange: 4.0.0.0 - 4.255.255.255 | ||
CIDR: 4.0.0.0/8 | ||
OriginAS: | ||
NetName: LVLT-ORG-4-8 | ||
NetHandle: NET-4-0-0-0-1 | ||
Parent: | ||
NetType: Direct Allocation | ||
RegDate: 1992-12-01 | ||
Updated: 2012-02-24 | ||
Ref: http://whois.arin.net/rest/net/NET-4-0-0-0-1 | ||
|
||
|
||
OrgName: Level 3 Communications, Inc. | ||
OrgId: LVLT | ||
Address: 1025 Eldorado Blvd. | ||
City: Broomfield | ||
StateProv: CO | ||
PostalCode: 80021 | ||
Country: US | ||
RegDate: 1998-05-22 | ||
Updated: 2012-01-30 | ||
Comment: ADDRESSES WITHIN THIS BLOCK ARE NON-PORTABLE | ||
Ref: http://whois.arin.net/rest/org/LVLT | ||
|
||
OrgTechHandle: IPADD5-ARIN | ||
OrgTechName: ipaddressing | ||
OrgTechPhone: +1-877-453-8353 | ||
OrgTechEmail: ipaddressing@level3.com | ||
OrgTechRef: http://whois.arin.net/rest/poc/IPADD5-ARIN | ||
|
||
OrgNOCHandle: NOCSU27-ARIN | ||
OrgNOCName: NOC Support | ||
OrgNOCPhone: +1-877-453-8353 | ||
OrgNOCEmail: noc.coreip@level3.com | ||
OrgNOCRef: http://whois.arin.net/rest/poc/NOCSU27-ARIN | ||
|
||
OrgAbuseHandle: APL8-ARIN | ||
OrgAbuseName: Abuse POC LVLT | ||
OrgAbusePhone: +1-877-453-8353 | ||
OrgAbuseEmail: security@level3.com | ||
OrgAbuseRef: http://whois.arin.net/rest/poc/APL8-ARIN | ||
|
||
# | ||
# ARIN WHOIS data and services are subject to the Terms of Use | ||
# available at: https://www.arin.net/whois_tou.html | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# | ||
# Query terms are ambiguous. The query is assumed to be: | ||
# "n 69.65.39.166" | ||
# | ||
# Use "?" to get help. | ||
# | ||
|
||
# | ||
# The following results may also be obtained via: | ||
# http://whois.arin.net/rest/nets;q=69.65.39.166?showDetails=true&showARIN=false&ext=netref2 | ||
# | ||
|
||
NetRange: 69.65.0.0 - 69.65.63.255 | ||
CIDR: 69.65.0.0/18 | ||
OriginAS: | ||
NetName: IPNAP | ||
NetHandle: NET-69-65-0-0-1 | ||
Parent: NET-69-0-0-0-0 | ||
NetType: Direct Allocation | ||
Comment: www.gigenet.com | ||
RegDate: 2003-07-30 | ||
Updated: 2012-03-02 | ||
Ref: http://whois.arin.net/rest/net/NET-69-65-0-0-1 | ||
|
||
OrgName: GigeNET | ||
OrgId: DMPL | ||
Address: 545 E Algonquin Rd | ||
Address: Suite D | ||
City: Arlington Heights | ||
StateProv: IL | ||
PostalCode: 60005 | ||
Country: US | ||
RegDate: 2011-03-04 | ||
Updated: 2011-06-23 | ||
Comment: http://www.gigenet.com | ||
Ref: http://whois.arin.net/rest/org/DMPL | ||
|
||
ReferralServer: rwhois://rwhois.servernap.net:4321 | ||
|
||
OrgTechHandle: IPADM152-ARIN | ||
OrgTechName: IP Administrator | ||
OrgTechPhone: +1-800-561-2656 | ||
OrgTechEmail: ip-admin@coloquest.com | ||
OrgTechRef: http://whois.arin.net/rest/poc/IPADM152-ARIN | ||
|
||
OrgNOCHandle: IPADM152-ARIN | ||
OrgNOCName: IP Administrator | ||
OrgNOCPhone: +1-800-561-2656 | ||
OrgNOCEmail: ip-admin@coloquest.com | ||
OrgNOCRef: http://whois.arin.net/rest/poc/IPADM152-ARIN | ||
|
||
OrgAbuseHandle: ABUSE2935-ARIN | ||
OrgAbuseName: Abuse Department | ||
OrgAbusePhone: +1-800-561-2656 | ||
OrgAbuseEmail: abuse@gigenet.com | ||
OrgAbuseRef: http://whois.arin.net/rest/poc/ABUSE2935-ARIN | ||
|
||
# | ||
# ARIN WHOIS data and services are subject to the Terms of Use | ||
# available at: https://www.arin.net/whois_tou.html | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# | ||
# Query terms are ambiguous. The query is assumed to be: | ||
# "n 130.66.76.222" | ||
# | ||
# Use "?" to get help. | ||
# | ||
|
||
# | ||
# The following results may also be obtained via: | ||
# http://whois.arin.net/rest/nets;q=130.66.76.222?showDetails=true&showARIN=false&ext=netref2 | ||
# | ||
|
||
NetRange: 130.66.0.0 - 130.67.255.255 | ||
CIDR: 130.66.0.0/15 | ||
OriginAS: | ||
NetName: RIPE-ERX-130-66-0-0 | ||
NetHandle: NET-130-66-0-0-1 | ||
Parent: NET-130-0-0-0-0 | ||
NetType: Early Registrations, Transferred to RIPE NCC | ||
Comment: These addresses have been further assigned to users in | ||
Comment: the RIPE NCC region. Contact information can be found in | ||
Comment: the RIPE database at http://www.ripe.net/whois | ||
RegDate: 2003-11-12 | ||
Updated: 2003-11-12 | ||
Ref: http://whois.arin.net/rest/net/NET-130-66-0-0-1 | ||
|
||
OrgName: RIPE Network Coordination Centre | ||
OrgId: RIPE | ||
Address: P.O. Box 10096 | ||
City: Amsterdam | ||
StateProv: | ||
PostalCode: 1001EB | ||
Country: NL | ||
RegDate: | ||
Updated: 2011-09-24 | ||
Ref: http://whois.arin.net/rest/org/RIPE | ||
|
||
ReferralServer: whois://whois.ripe.net:43 | ||
|
||
OrgAbuseHandle: RNO29-ARIN | ||
OrgAbuseName: RIPE NCC Operations | ||
OrgAbusePhone: +31 20 535 4444 | ||
OrgAbuseEmail: hostmaster@ripe.net | ||
OrgAbuseRef: http://whois.arin.net/rest/poc/RNO29-ARIN | ||
|
||
OrgTechHandle: RNO29-ARIN | ||
OrgTechName: RIPE NCC Operations | ||
OrgTechPhone: +31 20 535 4444 | ||
OrgTechEmail: hostmaster@ripe.net | ||
OrgTechRef: http://whois.arin.net/rest/poc/RNO29-ARIN | ||
|
||
# | ||
# ARIN WHOIS data and services are subject to the Terms of Use | ||
# available at: https://www.arin.net/whois_tou.html | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
require 'spec_helper' | ||
|
||
describe Whois::Server::Adapters::Arin do | ||
|
||
let(:definition) { [:ipv4, "0.0.0.0/1", "whois.arin.net"] } | ||
let(:server) { klass.new(*definition) } | ||
|
||
describe "#lookup" do | ||
context "without referral" do | ||
it "returns the WHOIS record" do | ||
response = "Whois Response" | ||
expected = response | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(response) | ||
record = server.lookup("0.0.0.0") | ||
record.to_s.should == expected | ||
record.parts.should have(1).part | ||
record.parts.should == [Whois::Record::Part.new(:body => response, :host => "whois.arin.net")] | ||
end | ||
end | ||
|
||
context "with referral" do | ||
it "follows whois:// referrals" do | ||
referral = File.read(fixture("referrals/arin_referral_whois.txt")) | ||
response = "Whois Response" | ||
expected = referral + "\n" + response | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral) | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.ripe.net", 43).returns(response) | ||
|
||
record = server.lookup("0.0.0.0") | ||
record.to_s.should == expected | ||
record.parts.should have(2).parts | ||
record.parts.should == [Whois::Record::Part.new(:body => referral, :host => "whois.arin.net"), | ||
Whois::Record::Part.new(:body => response, :host => "whois.ripe.net")] | ||
end | ||
|
||
it "follows rwhois:// referrals" do | ||
referral = File.read(fixture("referrals/arin_referral_rwhois.txt")) | ||
response = "Whois Response" | ||
expected = referral + "\n" + response | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral) | ||
server.query_handler.expects(:call).with("0.0.0.0", "rwhois.servernap.net", 4321).returns(response) | ||
|
||
record = server.lookup("0.0.0.0") | ||
record.to_s.should == expected | ||
record.parts.should have(2).parts | ||
record.parts.should == [Whois::Record::Part.new(:body => referral, :host => "whois.arin.net"), | ||
Whois::Record::Part.new(:body => response, :host => "rwhois.servernap.net")] | ||
end | ||
|
||
it "ignores referral if options[:referral] is false" do | ||
referral = File.read(fixture("referrals/arin_referral_whois.txt")) | ||
server.options[:referral] = false | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral) | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.ripe.net", 43).never | ||
|
||
record = server.lookup("0.0.0.0") | ||
record.parts.should have(1).part | ||
end | ||
|
||
it "ignores referral (gracefully) if missing" do | ||
referral = File.read(fixture("referrals/arin_referral_missing.txt")) | ||
server.query_handler.expects(:call).with("0.0.0.0", "whois.arin.net", 43).returns(referral) | ||
server.query_handler.expects(:call).never | ||
|
||
record = server.lookup("0.0.0.0") | ||
record.parts.should have(1).part | ||
end | ||
end | ||
|
||
end | ||
|
||
end |