Sha256: c8b7c4992ca7ef888239408d83fff5bdadd5bac31d012c88c6da40956b5ec2ef

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe AuthenticatedClient::AuthenticatedClient do
  before :each do
  end

  it 'has a version number' do
    expect(AuthenticatedClient::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 = AuthenticatedClient::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 = AuthenticatedClient::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
authenticated_client-0.0.3 spec/auth_client_spec.rb
authenticated_client-0.0.2 spec/auth_client_spec.rb
authenticated_client-0.0.1 spec/auth_client_spec.rb