spec/sonar/search_spec.rb in sonar-client-0.1.3 vs spec/sonar/search_spec.rb in sonar-client-0.1.4
- old
+ new
@@ -2,10 +2,28 @@
require 'spec_helper'
describe Sonar::Search do
let(:client) { Sonar::Client.new }
+ describe "#ip_search_type_names" do
+ it 'includes rdns' do
+ expect(subject.ip_search_type_names).to include('rdns')
+ end
+ it 'does not include fdns' do
+ expect(subject.ip_search_type_names).to_not include('fdns')
+ end
+ end
+
+ describe "#domain_search_type_names" do
+ it 'includes fdns' do
+ expect(subject.domain_search_type_names).to include('fdns')
+ end
+ it 'does not include rdns' do
+ expect(subject.domain_search_type_names).to_not include('rdns')
+ end
+ end
+
describe "parameters" do
describe "query type" do
context "with an invalid query type" do
it "should raise an ArgumentError" do
expect { client.search(invalid: 'something.org') }.to raise_error(ArgumentError)
@@ -13,16 +31,16 @@
end
end
describe "exact" do
it "shouldn't match anything when #exact is true" do
- resp = client.search(rdns: "1.1.", exact: true)
+ resp = client.search(fdns: ".rapid7.com", exact: true)
expect(resp["collection"].size).to eq(0)
end
it "should match when #exact is false" do
- resp = client.search(rdns: "1.1.", exact: false)
- expect(resp["collection"].first["address"]).to match(/^1.1./)
+ resp = client.search(fdns: ".rapid7.com", exact: false)
+ expect(resp["collection"].size).to be > 0
end
end
describe "limit" do
# The default size from APIv1/v2 is 1,000 records
@@ -147,17 +165,9 @@
context "sslcert" do
let(:resp) { client.search(sslcert: '1e80c24b97c928bb1db7d4d3c05475a6a40a1186') }
it "should provide sslcert details" do
expect(resp).to have_key('collection')
- end
- end
-
- context "whois_ip" do
- let(:resp) { client.search(whois_ip: '208.118.227.10') }
-
- xit "should find rapid7.com" do
- expect(resp['name']).to eq('TWDX-208-118-227-0-1')
end
end
# TODO: actually check response
context "raw" do