Sha256: 517c1a7256d78b804971e4116a9a0f587f869dee630260fa9705f1a28a18cde9

Contents?: true

Size: 967 Bytes

Versions: 18

Compression:

Stored size: 967 Bytes

Contents

require 'spec_helper'

describe Conjur::Command::Elevate do
  describe_command "elevate user show alice" do
    include_context "with mock authn"
    
    let(:token) { {login: 'dknuth'} }
    before{
      expect(Conjur::Authn).to receive(:connect).and_return(api)
    }
    it "invokes the sub-command with X-Conjur-Privilege header" do
      allow_any_instance_of(Conjur::API).to receive(:token).and_return(token)
      expect(Conjur::Command).to receive(:api=) do |api|
        expect(api.api_key).to eq("sekrit")
        expect(api.privilege).to eq("elevate")
      end.and_call_original
      
      expect(RestClient::Request).to receive(:execute).with({
        method: :get,
        url: "https://core.example.com/api/users/alice",
        username: "dknuth",
        headers: {:authorization=>"Token token=\"eyJsb2dpbiI6ImRrbnV0aCJ9\"", x_conjur_privilege: "elevate"}
      }).and_return(double(:response, body: "[]"))
      
      invoke
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
conjur-cli-5.6.6 spec/command/elevate_spec.rb
conjur-cli-5.6.5 spec/command/elevate_spec.rb
conjur-cli-5.6.4 spec/command/elevate_spec.rb
conjur-cli-5.6.3 spec/command/elevate_spec.rb
conjur-cli-5.5.0 spec/command/elevate_spec.rb
conjur-cli-5.4.0 spec/command/elevate_spec.rb
conjur-cli-5.3.0 spec/command/elevate_spec.rb
conjur-cli-5.2.5 spec/command/elevate_spec.rb
conjur-cli-5.2.4 spec/command/elevate_spec.rb
conjur-cli-5.2.3 spec/command/elevate_spec.rb
conjur-cli-5.2.1 spec/command/elevate_spec.rb
conjur-cli-5.2.0 spec/command/elevate_spec.rb
conjur-cli-5.1.2 spec/command/elevate_spec.rb
conjur-cli-5.1.1 spec/command/elevate_spec.rb
conjur-cli-5.1.0 spec/command/elevate_spec.rb
conjur-cli-4.30.1 spec/command/elevate_spec.rb
conjur-cli-4.30.0 spec/command/elevate_spec.rb
conjur-cli-4.29.0 spec/command/elevate_spec.rb