Sha256: a543390b1881eaf3386f4e6425c6ad62be327a97e116745e839dba1019071d4f

Contents?: true

Size: 1.63 KB

Versions: 89

Compression:

Stored size: 1.63 KB

Contents

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

describe "listing products" do
  include ProductHelpers

  let(:empty_response_table) do
    <<eostring
---|------|-------------|--------------|--------------|-----------
ID | NAME | DESCRIPTION | ORGANIZATION | REPOSITORIES | SYNC STATE
---|------|-------------|--------------|--------------|-----------
eostring
  end

  it 'displays the table properly' do
    api_expects(:products, :index, 'index products').returns(index_response([]))
    assert_cmd(
      success_result(empty_response_table),
      run_cmd(%w(product list --organization-id 1))
    )
  end

  it 'by organization ID' do
    ex = api_expects(:products, :index, 'index products') do |par|
      par['organization_id'] == 1
    end
    ex.returns(index_response([]))

    assert_equal(
      0,
      run_cmd(%w(product list --organization-id 1)).exit_code
    )
  end

  it 'by organization ID and subscription ID' do
    ex = api_expects(:products, :index, 'organization product list') do |par|
      par['organization_id'] == 1 && par['subscription_id'] == 1
    end
    ex.returns(index_response([]))

    assert_equal(
      0,
      run_cmd(%w(product list --organization-id 1 --subscription-id 1)).exit_code
    )
  end

  it 'by organization ID and sync plan ID' do
    ex = api_expects(:products, :index, 'organization product list') do |par|
      par['organization_id'] == 1 && par['sync_plan_id'] == 1
    end
    ex.returns(index_response([]))

    assert_equal(
      0,
      run_cmd(%w(product list --organization-id 1 --sync-plan-id 1)).exit_code
    )
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
hammer_cli_katello-1.16.1 test/functional/product/list_test.rb
hammer_cli_katello-1.15.0 test/functional/product/list_test.rb
hammer_cli_katello-1.14.3 test/functional/product/list_test.rb
hammer_cli_katello-1.14.2 test/functional/product/list_test.rb
hammer_cli_katello-1.14.0 test/functional/product/list_test.rb
hammer_cli_katello-1.14.1 test/functional/product/list_test.rb
hammer_cli_katello-1.12.0 test/functional/product/list_test.rb
hammer_cli_katello-1.11.2 test/functional/product/list_test.rb
hammer_cli_katello-1.11.1 test/functional/product/list_test.rb
hammer_cli_katello-1.11.0 test/functional/product/list_test.rb
hammer_cli_katello-1.10.1 test/functional/product/list_test.rb
hammer_cli_katello-1.10.0 test/functional/product/list_test.rb
hammer_cli_katello-1.8.3 test/functional/product/list_test.rb
hammer_cli_katello-1.8.2 test/functional/product/list_test.rb
hammer_cli_katello-1.9.1 test/functional/product/list_test.rb
hammer_cli_katello-1.9.0 test/functional/product/list_test.rb
hammer_cli_katello-1.8.1 test/functional/product/list_test.rb
hammer_cli_katello-1.7.3 test/functional/product/list_test.rb
hammer_cli_katello-1.8.0 test/functional/product/list_test.rb
hammer_cli_katello-1.7.2 test/functional/product/list_test.rb