Sha256: 230b9320a26a39df3e1647cc168b581ad084772df84ea20b0ae52d25d3292e63
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
require 'spec_helper' describe Conjur::Command::Variables, logged_in: true do let(:collection_url) { "https://core.example.com/variables" } let(:base_payload) { { mime_type: 'text/json', kind: 'password' } } describe_command "variable:create -m text/json -k password" do it "lets the server assign the id" do expect(RestClient::Request).to receive(:execute).with( method: :post, url: collection_url, headers: {}, payload: base_payload ).and_return(post_response('assigned-id')) expect { invoke }.to write({ id: 'assigned-id' }).to(:stdout) end end describe_command "variable:create -m text/json -k password the-id" do it "propagates the user-assigned id" do expect(RestClient::Request).to receive(:execute).with( method: :post, url: collection_url, headers: {}, payload: base_payload.merge({ id: 'the-id' }) ).and_return(post_response('the-id')) expect { invoke }.to write({ id: 'the-id' }).to(:stdout) end end describe_command "variable:create" do it "provides default values for optional parameters mime_type and kind" do expect(RestClient::Request).to receive(:execute).with( method: :post, url: collection_url, headers: {}, payload: { mime_type: 'text/plain', kind: 'secret'} ).and_return(post_response('the-id')) expect { invoke }.to write # invoke_silently end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
conjur-cli-4.17.0 | spec/command/variables_spec.rb |
conjur-cli-4.16.0 | spec/command/variables_spec.rb |
conjur-cli-4.15.0 | spec/command/variables_spec.rb |