Sha256: 9863ceb4672c274edc2b40a189047fa733d2cfcaaaf604f2e926f4a002201514

Contents?: true

Size: 887 Bytes

Versions: 3

Compression:

Stored size: 887 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

3 entries across 3 versions & 1 rubygems

Version Path
conjur-cli-4.28.2 spec/command/hosts_spec.rb
conjur-cli-4.28.1 spec/command/hosts_spec.rb
conjur-cli-4.28.0 spec/command/hosts_spec.rb