Sha256: 2ea6722bd5534feb5b702849b8602d4255964dd5f05655934df4c794497a1c13

Contents?: true

Size: 856 Bytes

Versions: 73

Compression:

Stored size: 856 Bytes

Contents

module ProductHelpers
  def expect_generic_product_search(params = {}, returns = {})
    api_expects(:products, :index, 'Find the Product')
      .with_params(params).returns(index_response([returns]))
  end

  def expect_product_search(org_id, name, id)
    expect_generic_product_search({'name' => name, 'organization_id' => org_id}, 'id' => id)
  end

  def expect_product_show(options = {})
    raise "#{__method__} must be called with :id" unless (options.keys & [:id]).size == 1

    if options[:name]
      raise "#{__method__} used with :name also requires :org_id" unless options[:org_id]
      expect_product_search(options[:org_id], options[:name], options[:id])
    end

    ex = api_expects(:products, :show, 'Show a Product') do |par|
      par['id'] == options[:id]
    end
    ex.returns(index_response([{'id' => options[:id]}]))
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

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