Sha256: 21b24c025a4f532185235070005c3dde427d63dccd68b74e8d938e9d1edef8d8

Contents?: true

Size: 1.71 KB

Versions: 12

Compression:

Stored size: 1.71 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')
require 'hammer_cli_foreman_openscap/policy'

describe HammerCLIForemanOpenscap::Policy do
  include CommandTestHelper

  context "ListCommand" do
    let(:cmd) { HammerCLIForemanOpenscap::Policy::ListCommand.new "", ctx }

    before :each do
      ComplianceResourceMock.policies_list
    end

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

    context "output" do
      let(:expected_record_count) { cmd.resource.call(:index).length }
      it_should_print_n_records
      it_should_print_columns ["Id", "Name", "Created at"]
    end
  end

  context "InfoCommand" do
    let(:cmd) { HammerCLIForemanOpenscap::Policy::InfoCommand.new("", ctx) }

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

    context "output" do
      with_params ["--id=1"] do
        it_should_print_n_records 1
        it_should_print_columns ["Id", "Name", "Created at", "Period", "Weekday",
                                 "Day of month", "Cron line", "SCAP content Id",
                                 "SCAP Content profile Id", "Hostgroups"]
      end
    end
  end

  context "DeleteCommand" do
    let(:cmd) { HammerCLIForemanOpenscap::Policy::DeleteCommand.new("", ctx) }

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

  context "UpdateCommand" do
    let(:cmd) { HammerCLIForemanOpenscap::Policy::UpdateCommand.new("", ctx) }

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hammer_cli_foreman_openscap-0.2.2 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.2.1 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.2.0 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.13 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.12 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.11 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.10 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.9 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.8 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.7 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.6 test/unit/policy_test.rb
hammer_cli_foreman_openscap-0.1.5 test/unit/policy_test.rb