GithubHelp home page GithubHelp logo

kryndex / hammer-cli-katello Goto Github PK

View Code? Open in Web Editor NEW

This project forked from katello/hammer-cli-katello

0.0 1.0 0.0 1.09 MB

Next-gen CLI tool for Katello (Katello-specific commands)

License: GNU General Public License v3.0

Ruby 99.56% Makefile 0.44%

hammer-cli-katello's Introduction

hammer-cli-katello Build Status Coverage Status

Next-gen CLI tool for Katello (Katello-specific commands)

hammer-cli development docs for help

Development setup

The easiest way to set up a hammer development environment is to use the centos7-hammer-devel box in forklift.

Configuration

Configuration files for all hammer plugins are found at ~/.hammer/cli.modules.d. The centos7-hammer-devel box configures hammer for you, but you may change the configuration files directly as well. The hammer-cli-katello configuration is located at ~/.hammer/cli.modules.d/katello.yml.

The overall hammer config is found at ~/.hammer/cli_config.yml. The hammer-cli docs provide more information on possible configuration values. One useful configuration option is the Katello server to point to; that is found in ~/.hammer/cli.modules.d/foreman.yml.

Running Hammer

Hammer is run as an executable from the root of the hammer-cli-katello repository.

bundle exec hammer -vh

Look for any errors. If you see none, you should be good to go.

Testing

To run the tests with rubocop:

rake

To run the tests only:

rake test

To run a specific test:

rake test TEST="test/functional/content_views/show_test.rb"

There are both unit tests and functional tests. Unit tests are used for supporting code, such as lib/hammer_cli_katello/id_resolver.rb. Functional tests are used for testing the input/output interaction of hammer with the Katello API.

hammer-cli-foreman stubs the API for functional tests. See api_expectations.rb. To regenerate the stubbed API, refer to the test data Readme.

Each subcommand action is tested in its own test file. An example is hammer content-view update; it is stored in test/functional/content_view/update_test.rb.

For most hammer sub-commands, there are common API calls that are used to resolve database object IDs. These are usually accompanied with helpers to test the common API calls. An example is the OrganizationHelpers.

A typical functional test takes this form:

it 'allows minimal options' do
  api_expects(:content_views, :update) do |p| # expect an API call to ContentViews#Update
    p['id'] == 2 # expect the params to include {'id' => 2}
  end

  run_cmd(%w(content-view update --id 2)) # Run the hammer command to test
end

hammer-cli-katello's People

Contributors

adamruzicka avatar ahumbe avatar akofink avatar anandkumaragrawal avatar bbuckingham avatar beav avatar bkearney avatar cfouant avatar chris1984 avatar daviddavis avatar dlobatog avatar ehelms avatar evgeni avatar inecas avatar jlconnor avatar jlsherrill avatar jmontleon avatar komidore64 avatar mbacovsky avatar mkelley33 avatar omaciel avatar parthaa avatar pmoravec avatar ranjan avatar snagoor avatar stbenjam avatar thomasmckay avatar upadhyeammit avatar waldenraines avatar zjhuntin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.