Add throttle detection for Network Solutions parser #182

Merged
merged 3 commits into from Sep 5, 2012
@@ -81,6 +81,9 @@ class WhoisNetworksolutionsCom < Base
end
end
+ def response_throttled?
+ !!(content_for_scanner =~ /The IP address from which you have visited/)
+ end
private
@@ -0,0 +1,2 @@
+#response_throttled?
+ should: %s == true
@@ -0,0 +1,21 @@
+Welcome to the Network Solutions(R) Registrar WHOIS Server.
+
+The IP address from which you have visited the Network Solutions Registrar WHOIS
+database is contained within a list of IP addresses that may have failed
+to abide by Network Solutions' WHOIS policy. Failure to abide by this policy can
+adversely impact our systems and servers, preventing the processing of
+other WHOIS requests.
+
+To see the Network Solutions WHOIS Policy, click on or copy and paste the following
+URL into your browser:
+
+http://www.networksolutions.com/whois/index.jhtml
+
+If you feel that you have received this message in error, please email us using the online
+form at http://www.networksolutions.com/help/email.jsp with the following information:
+
+Whois Query: domain.com
+YOUR IP address is 12.23.34.45
+Date and Time of Query: Thu Aug 23 13:57:48 EDT 2012
+Reason Code: IE
+
@@ -7,6 +7,9 @@
#registered?
should: %s == true
+#response_throttled?
+ should: %s == false
+
#created_on
should: %s CLASS(time)
@@ -0,0 +1,29 @@
+# encoding: utf-8
+
+# This file is autogenerated. Do not edit it manually.
+# If you want change the content of this file, edit
+#
+# /spec/fixtures/responses/whois.networksolutions.com/response_throttled.expected
+#
+# and regenerate the tests with the following rake task
+#
+# $ rake spec:generate
+#
+
+require 'spec_helper'
+require 'whois/record/parser/whois.networksolutions.com.rb'
+
+describe Whois::Record::Parser::WhoisNetworksolutionsCom, "response_throttled.expected" do
+
+ before(:each) do
+ file = fixture("responses", "whois.networksolutions.com/response_throttled.txt")
+ part = Whois::Record::Part.new(:body => File.read(file))
+ @parser = klass.new(part)
+ end
+
+ describe "#response_throttled?" do
+ it do
+ @parser.response_throttled?.should == true
+ end
+ end
+end
@@ -36,6 +36,11 @@
@parser.registered?.should == true
end
end
+ describe "#response_throttled?" do
+ it do
+ @parser.response_throttled?.should == false
+ end
+ end
describe "#created_on" do
it do
@parser.created_on.should be_a(Time)