Sha256: 0e816441de63f223cd0a7d50ece14e1b01661a028a91f639ad30b6d3807c5266

Contents?: true

Size: 880 Bytes

Versions: 7

Compression:

Stored size: 880 Bytes

Contents

require 'spec_helper'

describe Conjur::Command::Hosts, logged_in: true do
  let(:collection_url) { "https://core.example.com/hosts" }
  
  describe_command "host:create" do
    it "lets the server assign the id" do
     expect(RestClient::Request).to receive(:execute).with(
        method: :post,
        url: collection_url,
        headers: {},
        payload: {}
      ).and_return(post_response('assigned-id'))

      expect { invoke }.to write({ id: 'assigned-id' }).to(:stdout)
    end
  end
  describe_command "host:create the-id" do
    it "propagates the user-assigned id" do
     expect(RestClient::Request).to receive(:execute).with(
        method: :post,
        url: collection_url,
        headers: {},
        payload: { id: 'the-id' }
      ).and_return(post_response('the-id'))

      expect { invoke }.to write({ id: 'the-id' }).to(:stdout)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
conjur-cli-4.20.1 spec/command/hosts_spec.rb
conjur-cli-4.19.0 spec/command/hosts_spec.rb
conjur-cli-4.18.6 spec/command/hosts_spec.rb
conjur-cli-4.18.0 spec/command/hosts_spec.rb
conjur-cli-4.17.0 spec/command/hosts_spec.rb
conjur-cli-4.16.0 spec/command/hosts_spec.rb
conjur-cli-4.15.0 spec/command/hosts_spec.rb