Sha256: b2cbe0e1eeb3f3f281d41315629ebbd8bfb8e65116b6d27a442de6036e5b7d79

Contents?: true

Size: 1.26 KB

Versions: 56

Compression:

Stored size: 1.26 KB

Contents

require 'kontena/cli/vault/export_command'

describe Kontena::Cli::Vault::ExportCommand do

  include RequirementsHelper

  let(:subject) do
    described_class.new(File.basename($0))
  end

  expect_to_require_current_master

  before(:each) do
    allow(Kontena::Cli::Config.instance).to receive(:current_master).and_return(Kontena::Cli::Config::Server.new)
  end

  it 'goes through the list of vault keys and outputs a yaml' do
    expect(Kontena).to receive(:run!).with(['vault', 'ls', '--return']).and_return(['foo', 'bar'])
    expect(Kontena).to receive(:run!).with(['vault', 'read', '--return', 'bar']).and_return('barbar')
    expect(Kontena).to receive(:run!).with(['vault', 'read', '--return', 'foo']).and_return('foofoo')
    expect{subject.run([])}.to output(/bar: barbar\nfoo: foofoo/).to_stdout
  end

  it 'goes through the list of vault keys and outputs a json' do
    expect(Kontena).to receive(:run!).with(['vault', 'ls', '--return']).and_return(['foo', 'bar'])
    expect(Kontena).to receive(:run!).with(['vault', 'read', '--return', 'bar']).and_return('barbar')
    expect(Kontena).to receive(:run!).with(['vault', 'read', '--return', 'foo']).and_return('foofoo')
    expect{subject.run(['--json'])}.to output(/\"bar\":\"barbar\",\"foo\":\"foofoo\"/).to_stdout
  end

end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
kontena-cli-1.5.4 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.4.rc1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.3 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.2 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0.rc1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0.pre5 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0.pre4 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0.pre3 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0.pre2 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.5.0.pre1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.3 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.3.rc1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.2 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.2.rc1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.2.pre1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.1.rc1 spec/kontena/cli/vault/export_command_spec.rb
kontena-cli-1.4.1.pre1 spec/kontena/cli/vault/export_command_spec.rb