Sha256: 19c9a1ae64ce6b475c7c9ce93c359ab6753e03db8c26e8acd8d212a871830bff

Contents?: true

Size: 1.5 KB

Versions: 20

Compression:

Stored size: 1.5 KB

Contents

require 'kontena/cli/certificate/show_command'

describe Kontena::Cli::Certificate::ShowCommand do
  include ClientHelpers
  include OutputHelpers
  include FixturesHelpers

  let(:subject) { described_class.new("") }

  let(:certificate) {
    {
      'id' => 'test-grid/test.example.com',
      'subject' => 'test.example.com',
      'valid_until' => '2017-12-14T13:34:00.000+00:00',
      'alt_names' => [],
      'auto_renewable' => true,
    }
  }

  before do
    allow(client).to receive(:get).with('certificates/test-grid/test.example.com').and_return(certificate)
  end

  it "outputs the certificate info" do
    expect{subject.run(['test.example.com'])}.to output_lines([
      'test-grid/test.example.com:',
      '  subject: test.example.com',
      "  valid until: 2017-12-14T13:34:00Z",
      '  auto renewable: true',
    ])
  end

  context 'with certificate alt_names' do
    let(:certificate) {
      {
        'id' => 'test-grid/test.example.com',
        'subject' => 'test.example.com',
        'valid_until' => '2017-12-14T13:34:00.000+00:00',
        'alt_names' => [
            'test2.example.com',
        ],
        'auto_renewable' => true,
      }
    }

    it "outputs the certificate info" do
      expect{subject.run(['test.example.com'])}.to output_lines([
        'test-grid/test.example.com:',
        '  subject: test.example.com',
        "  valid until: 2017-12-14T13:34:00Z",
        '  alt names:',
        '    - test2.example.com',
        '  auto renewable: true',
      ])
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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