Sha256: d6f0f95bffe8dc3fc073356f3e176de97095a9f1724363f4ff9ed60843aeb973

Contents?: true

Size: 1.56 KB

Versions: 27

Compression:

Stored size: 1.56 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')

require 'hammer_cli_foreman/audit'

describe HammerCLIForeman::Audit do
  include CommandTestHelper

  context "ListCommand" do
    before do
      ResourceMocks.mock_action_call(:audits, :index, [])
    end

    let(:cmd) { HammerCLIForeman::Audit::ListCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "no arguments"
      it_should_accept_search_params
    end

    context "output" do
      let(:expected_record_count) { count_records(cmd.resource.call(:index)) }

      it_should_print_n_records
      it_should_print_column "Id"
      it_should_print_column "At"
      it_should_print_column "IP"
      it_should_print_column "User"
      it_should_print_column "Action"
      it_should_print_column "Audit type"
      it_should_print_column "Audit record"
    end
  end

  context "InfoCommand" do
    before do
        cmd.stubs(:extend_data)
    end

    let(:cmd) { HammerCLIForeman::Audit::InfoCommand.new("", ctx) }

    context "parameters" do
      it_should_accept "id", ["--id=1"]
    end

    context "output" do
      with_params ["--id=1"] do
        it_should_print_n_records 1
        it_should_print_column "Id"
        it_should_print_column "At"
        it_should_print_column "IP"
        it_should_print_column "User"
        it_should_print_column "Action"
        it_should_print_column "Audit type"
        it_should_print_column "Audit record"
        it_should_print_column "Audited changes"
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
hammer_cli_foreman-2.1.1 test/unit/audit_test.rb
hammer_cli_foreman-2.1.0 test/unit/audit_test.rb
hammer_cli_foreman-2.0.2 test/unit/audit_test.rb
hammer_cli_foreman-2.0.1 test/unit/audit_test.rb
hammer_cli_foreman-2.0.0 test/unit/audit_test.rb
hammer_cli_foreman-0.19.7 test/unit/audit_test.rb
hammer_cli_foreman-0.19.6 test/unit/audit_test.rb
hammer_cli_foreman-0.19.5 test/unit/audit_test.rb
hammer_cli_foreman-0.19.4 test/unit/audit_test.rb
hammer_cli_foreman-0.19.3 test/unit/audit_test.rb
hammer_cli_foreman-0.19.2 test/unit/audit_test.rb
hammer_cli_foreman-0.18.2 test/unit/audit_test.rb
hammer_cli_foreman-0.19.1 test/unit/audit_test.rb
hammer_cli_foreman-0.18.1 test/unit/audit_test.rb
hammer_cli_foreman-0.19.0 test/unit/audit_test.rb
hammer_cli_foreman-0.17.2 test/unit/audit_test.rb
hammer_cli_foreman-0.18.0 test/unit/audit_test.rb
hammer_cli_foreman-0.17.1 test/unit/audit_test.rb
hammer_cli_foreman-0.17.0 test/unit/audit_test.rb
hammer_cli_foreman-0.15.2 test/unit/audit_test.rb