Sha256: f8872e26f93fa938066327e9fdf3c19c22caa9fb176f5696506703e48a274e0c
Contents?: true
Size: 1.76 KB
Versions: 3
Compression:
Stored size: 1.76 KB
Contents
require 'spec_helper' require 'stringio' describe Vcloud::Core::Fog::Login do describe "#token" do it "should return the output from get_token" do expect(subject).to receive(:check_plaintext_pass) expect(subject).to receive(:get_token).and_return('mekmitasdigoat') expect(subject.token('supersekret')).to eq("mekmitasdigoat") end end describe "#token_export" do it "should call #token with pass arg and return shell export string" do expect(subject).to receive(:token).with('supersekret').and_return('mekmitasdigoat') expect(subject.token_export("supersekret")).to eq("export FOG_VCLOUD_TOKEN=mekmitasdigoat") end end describe "#check_plaintext_pass" do context "vcloud_director_password not set" do it "should not raise an exception" do expect(Vcloud::Core::Fog).to receive(:fog_credentials_pass).and_return(nil) expect(subject).to receive(:get_token) expect { subject.token('supersekret') }.not_to raise_error end end context "vcloud_director_password empty string" do it "should not raise an exception" do expect(Vcloud::Core::Fog).to receive(:fog_credentials_pass).and_return('') expect(subject).to receive(:get_token) expect { subject.token('supersekret') }.not_to raise_error end end context "vcloud_director_password non-empty string" do it "should raise an exception" do expect(Vcloud::Core::Fog).to receive(:fog_credentials_pass).and_return('supersekret') expect(subject).to_not receive(:get_token) expect { subject.token('supersekret') }.to raise_error( RuntimeError, "Found plaintext vcloud_director_password entry. Please set it to an empty string" ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vcloud-core-0.10.0 | spec/vcloud/core/fog/login_spec.rb |
vcloud-core-0.9.0 | spec/vcloud/core/fog/login_spec.rb |
vcloud-core-0.8.0 | spec/vcloud/core/fog/login_spec.rb |