Project

General

Profile

Revision b50ceaa2

Added by Thomas McKay over 6 years ago

fixes #15916 - infrastructure to switch tests to use vcr

Switching to VCR will allow both running against a live server (as the existing tests do now) or to run in pre-recorded mode.

Setting initial code coverage to 26%

Added default rake task to run rubocop and test

View differences:

README.md
1
# hammer-cli-csv ![Travis # Status](https://travis-ci.org/Katello/hammer-cli-csv.svg?branch=master)
1
# hammer-cli-csv [![Build Status](https://travis-ci.org/Katello/hammer-cli-csv.svg?branch=master)](https://travis-ci.org/Katello/hammer-cli-csv) [![Coverage Status](https://coveralls.io/repos/github/Katello/hammer-cli-csv/badge.svg?branch=master)](https://coveralls.io/github/Katello/hammer-cli-csv?branch=master)
2 2

  
3 3
## Introduction
4 4

  
......
552 552

  
553 553
## Code style
554 554

  
555
```rubocop -R <file>```
555
    rubocop -R <file>
556 556

  
557 557
## Tests
558 558

  
559
The tests are meant to run against a live server.
559
To run all tests using recorded data, run:
560 560

  
561
```rake test TEST=test/settings_test.rb```
561
    rake test mode=none
562 562

  
563
Test server configuration is taken from test/config.yml
563
To run all tests to record data:
564 564

  
565
```
566
% cat test/config.yml
565
    rake test mode=all
567 566

  
568
:csv:
569
  :enable_module: true
567
To run a single test using recorded data, run:
570 568

  
571
:foreman:
572
  :enable_module: true
573
  :host:          'http://katello:3000'
574
  :username:      'admin'
575
  :password:      'changeme'
569
    rake test mode=none test=resources/settings
576 570

  
577
:katello:
578
  :enable_module: true
579
```
571
or
572

  
573
    rake test mode=none test=./test/resources/settings_test.rb
574

  
575
To run tests against your live Katello without recording a new cassette set record flag to false (does not apply to mode=none):
576

  
577
    record=false
578

  
579
To see RestClient logs while testing:
580

  
581
    logging=true
582

  
583
Test server configuration is taken from 'test/config.yml'. If that file does not exist then https://localhost with admin / changeme is the default.
584

  
585
    % cat test/config.yml
586

  
587
    :csv:
588
      :enable_module: true
589

  
590
    :foreman:
591
      :enable_module: true
592
      :host:          'http://katello:3000'
593
      :username:      'admin'
594
      :password:      'changeme'
595

  
596
    :katello:
597
      :enable_module: true

Also available in: Unified diff