Sha256: 3c0963ce468d2c3ab973938f40c18387b6fba9e26be500342aeab11af08584d6

Contents?: true

Size: 1.61 KB

Versions: 19

Compression:

Stored size: 1.61 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"
        it_should_print_column "Request UUID"
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hammer_cli_foreman-3.7.0 test/unit/audit_test.rb
hammer_cli_foreman-3.5.1 test/unit/audit_test.rb
hammer_cli_foreman-3.6.0 test/unit/audit_test.rb
hammer_cli_foreman-3.5.0 test/unit/audit_test.rb
hammer_cli_foreman-3.4.0 test/unit/audit_test.rb
hammer_cli_foreman-3.3.0 test/unit/audit_test.rb
hammer_cli_foreman-3.2.0 test/unit/audit_test.rb
hammer_cli_foreman-2.5.2 test/unit/audit_test.rb
hammer_cli_foreman-3.1.0 test/unit/audit_test.rb
hammer_cli_foreman-3.0.0 test/unit/audit_test.rb
hammer_cli_foreman-2.5.1 test/unit/audit_test.rb
hammer_cli_foreman-2.5.0 test/unit/audit_test.rb
hammer_cli_foreman-2.3.2 test/unit/audit_test.rb
hammer_cli_foreman-2.4.0 test/unit/audit_test.rb
hammer_cli_foreman-2.3.1 test/unit/audit_test.rb
hammer_cli_foreman-2.3.0 test/unit/audit_test.rb
hammer_cli_foreman-2.1.3 test/unit/audit_test.rb
hammer_cli_foreman-2.2.0 test/unit/audit_test.rb
hammer_cli_foreman-2.1.2 test/unit/audit_test.rb