Sha256: 2ce7868707dec6d78b6de4ef10d9f88ff6f3e0f034c946f5c731bee9b22eed85

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Sonar::Registration do
  let(:client) { Sonar::Client.new }

  context 'POSTing a valid product key' do
    let (:resp) do
      VCR.use_cassette("valid_ms_registration") do
        client.register_metasploit("SOME-VALID-KEY")
      end
    end

    it 'responds that the license is valid' do
      expect(resp).to have_key('valid')
      expect(resp['valid']).to be(true)
    end
    it 'responds with a user email' do
      expect(resp).to have_key('email')
      expect(resp['email']).to eq('metasploit-sdafsaefaef@rapid7.com')
    end
    it 'responds with an api_key' do
      expect(resp).to have_key('api_key')
      expect(resp['api_key']).to match('YOUR-VALID-API-KEY')
    end
  end

  context 'POSTing an invalid product key' do
    let (:resp) { client.register_metasploit("DDXXXX") }

    it 'responds that the license is invalid' do
      expect(resp).to have_key('valid')
      expect(resp['valid']).to be(false)
    end
    it 'responds with an error message' do
      expect(resp).to have_key('error')
      expect(resp['error']).to match(/not appear to be valid/)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sonar-client-0.2.0 spec/sonar/registration_spec.rb
sonar-client-0.1.6 spec/sonar/registration_spec.rb
sonar-client-0.1.4 spec/sonar/registration_spec.rb
sonar-client-0.1.3 spec/sonar/registration_spec.rb
sonar-client-0.1.2 spec/sonar/registration_spec.rb
sonar-client-0.1.1 spec/sonar/registration_spec.rb
sonar-client-0.1.1.pre spec/sonar/registration_spec.rb
sonar-client-0.0.9 spec/sonar/registration_spec.rb