Project

General

Profile

Download (1.05 KB) Statistics
| Branch: | Tag: | Revision:

hammer-cli-csv / test / roles_test.rb @ bf81b9cf

1 bfc065ce Tom McKay
require File.join(File.dirname(__FILE__), 'csv_test_helper')
2
#require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
3
require 'stringio'
4
require 'tempfile'
5
6
describe 'something' do
7
8
  extend CommandTestHelper
9
10
11
  before :each do
12
    HammerCLI::Settings.load_from_file ['test/config.yml']
13
  end
14
15
  context 'activation keys' do
16
17
    # Expected output of the form:
18
    # ID,Name,Consumed
19
    # 1,damon.dials@megacorp.com,0 of Unlimited
20
    it 'allows show' do
21
      set_user 'damon.dials@megacorp.com'
22
23
      stdout,stderr = capture {
24
        hammer.run(%W{activation-key list --organization-id megacorp}).must_equal HammerCLI::EX_OK
25
      }
26
      lines = stdout.split("\n")
27
      lines.length.must_equal 2
28
      lines[1].must_match /.*damon.dials@megacorp\.com.*/
29
30
      id = lines[1].split(',')[0]
31
      stdout,stderr = capture {
32
        hammer.run(%W{activation-key info --id #{id}}).must_equal HammerCLI::EX_OK
33
      }
34
      stdout.split("\n")[1].must_match /.*damon.dials@megacorp.com,[0-9]+,Individual account,Library,Default Organization View/
35
    end
36
37
  end
38
39
end