Sha256: 33ba7e7e64235157e04573e1bd9be97dbb2a3b802109da24a60b74849d118c64

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe Censys::API do
  before(:context) do
    @api = Censys::API.new
  end

  describe "#search", :vcr do
    context "ipv4" do
      it "should return IPv4 response" do
        res = @api.ipv4.search(query: "dropbox.com")
        expect(res).to be_a(Search::Response)
        expect(res.metadata).to be_a(Search::Metadata)
        expect(res.each).to be_a(Enumerator)
        expect(res.pages).to be_a(Enumerator)

        first = res.results.first
        expect(first).to be_a(Search::IPv4)
        expect(first.ip).to be_a(String)
        expect(first.protocols).to be_a(Array)
      end
    end

    context "websites" do
      it "should return Website response" do
        res = @api.websites.search(query: "dropbox.com")
        expect(res).to be_a(Search::Response)

        first = res.results.first
        expect(first).to be_a(Search::Website)
        expect(first.domain).to be_a(String)
        expect(first.alexa_rank).to be_a(Integer)
      end
    end

    context "certificates" do
      it "should return Certificate response" do
        res = @api.certificates.search(query: "dropbox.com")
        expect(res).to be_a(Search::Response)

        first = res.results.first
        expect(first).to be_a(Search::Certificate)
        expect(first.fingerprint_sha256).to be_a(String)
        expect(first.subject_dn).to be_a(String)
        expect(first.issuer_dn).to be_a(String)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
censu-0.1.4 spec/search_spec.rb
censu-0.1.3 spec/search_spec.rb
censu-0.1.2 spec/search_spec.rb
censu-0.1.1 spec/search_spec.rb