Skip to content

Commit

Permalink
tried to add a spec
Browse files Browse the repository at this point in the history
  • Loading branch information
atheiman committed Jun 7, 2019
1 parent c480f4b commit 5219a2b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion spec/unit/auth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@

module Vault
describe Authenticate do
let(:auth) { Authenticate.new(client: nil) }
let(:client) { double('client') }
let(:auth) { Authenticate.new(client: client) }

describe '#kubernetes' do
before do
allow(::File).to receive(:read).with(
'/var/run/secrets/kubernetes.io/serviceaccount/token'
).and_return('abc123')
end

it 'authenticates with Kubernetes Auth method' do
expect(client).to receive(:post).with('/v1/auth/kubernetes/login', '{"blah": "wrong"}')
expect(auth.kubernetes('test-role')).to eq('secret')
end
end

describe "#region_from_sts_endpoint" do
subject { auth.send(:region_from_sts_endpoint, sts_endpoint) }

Expand Down

0 comments on commit 5219a2b

Please sign in to comment.