Sha256: 6d2b58e164d14723c973ce3f761d295de20f91784d43127097adb23f8abbff37

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe SoarAuthenticationToken::AuthenticatedClient do
  before :each do
  end

  it 'has a version number' do
    expect(SoarAuthenticationToken::VERSION).not_to be nil
  end

  context "when performing an authenticated request" do
    context "with a valid token" do
      it 'respond with a successful request' do
        @iut = SoarAuthenticationToken::AuthenticatedClient.new
        @iut.url = 'http://authentication-token-generator-service:9393/generate'
        @iut.token = 'test_ecosystem_token_for_auth_token_aaapi_authenticator_service'
        @iut.verb = :post
        @iut.parameters = {}
        @iut.body = {}
        @iut.auditing = nil

        response = @iut.request
        expect(response.code).to eq '200'
      end
    end
    context "with an invalid token" do
      it 'respond unauthorized' do
        @iut = SoarAuthenticationToken::AuthenticatedClient.new
        @iut.url = 'http://authentication-token-generator-service:9393/generate'
        @iut.token = 'invalid'
        @iut.verb = :post
        @iut.parameters = {}
        @iut.body = {}
        @iut.auditing = nil

        response = @iut.request
        expect(response.code).to eq '401'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
soar_authentication_token-3.0.4 spec/auth_client_spec.rb
soar_authentication_token-3.0.3 spec/auth_client_spec.rb
soar_authentication_token-3.0.2 spec/auth_client_spec.rb