Sha256: 7d0d66ab72c53a22d34cb629351cf324c849407b48c824ef26afcc559fce2154
Contents?: true
Size: 942 Bytes
Versions: 6
Compression:
Stored size: 942 Bytes
Contents
require 'spec_helper' require 'tempfile' require 'write_expectation' describe Conjur::Command::Authn do let(:netrcfile) { Tempfile.new 'authtest' } let(:netrc) { Netrc.read(netrcfile.path) } let(:host) { 'https://authn.example.com' } before do Conjur::Authn.stub netrc: netrc, host: host end context "when not logged in" do describe_command 'authn:whoami' do it "errors out" do expect{ invoke }.to write(/not logged in/i).to :stderr end end end context "when logged in" do let(:username) { 'dknuth' } let(:api_key) { 'sekrit' } before { netrc[host] = [username, api_key] } describe_command 'authn:logout' do it "deletes credentials" do invoke netrc[host].should_not be end end describe_command 'authn:whoami' do it "prints the current username to stdout" do expect { invoke }.to write username end end end end
Version data entries
6 entries across 6 versions & 1 rubygems