Project

General

Profile

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

hammer-cli-csv / test / setup_test.rb @ 8e5eda06

1
require File.join(File.dirname(__FILE__), 'csv_test_helper')
2

    
3
describe 'setup' do
4

    
5
  extend CommandTestHelper
6

    
7
  before :each do
8
    HammerCLI::Settings.load_from_file ['test/config.yml']
9
  end
10

    
11
  context 'Setup Organizations' do
12
    it "hammer -v csv:organizations --csv-file test/data/organizations.csv" do
13
      stdout,stderr = capture {
14
        hammer.run(%W{-v csv:organizations --csv-file test/data/organizations.csv})
15
      }
16
      stderr.must_equal ''
17
      stdout.must_match /.*organization 'Mega Corporation'.*/
18
    end
19
  end
20

    
21
  context 'Setup Locations' do
22
    it "hammer -v csv:locations --csv-file test/data/locations.csv" do
23
      stdout,stderr = capture {
24
        hammer.run(%W{-v csv:locations --csv-file test/data/locations.csv})
25
      }
26
      stderr.must_equal ''
27
      stdout.must_match /.*Asia Pacific.*/
28
    end
29
  end
30

    
31
  context 'Setup' do
32
    it "hammer -v csv:operatingsystems --csv-file test/data/operatingsystems.csv" do
33
      stdout,stderr = capture {
34
        hammer.run(%W{-v csv:operatingsystems --csv-file test/data/operatingsystems.csv})
35
      }
36
      stderr.must_equal ''
37
      stdout.must_match /.*operating system 'Fedora 18'.*/
38
    end
39
  end
40

    
41
  context 'Setup' do
42
    it "hammer -v csv:architectures --csv-file test/data/architectures.csv" do
43
      stdout,stderr = capture {
44
        hammer.run(%W{-v csv:architectures --csv-file test/data/architectures.csv})
45
      }
46
      stderr.must_equal ''
47
      stdout.must_match /.*architecture 'x86_64'.*/
48
    end
49
  end
50

    
51
  context 'Setup' do
52
    it "hammer -v csv:partitiontables --csv-file test/data/partitiontables.csv" do
53
      stdout,stderr = capture {
54
        hammer.run(%W{-v csv:partitiontables --csv-file test/data/partitiontables.csv})
55
      }
56
      stderr.must_equal ''
57
      stdout.must_match /.*ptable 'ext4 default'.*/
58
    end
59
  end
60

    
61
  context 'Setup' do
62
    it "hammer -v csv:domains --csv-file test/data/domains.csv" do
63
      stdout,stderr = capture {
64
        hammer.run(%W{-v csv:domains --csv-file test/data/domains.csv})
65
      }
66
      stderr.must_equal ''
67
      stdout.must_match /.*domain 'megacorp.com'.*/
68
    end
69
  end
70

    
71
  context 'Setup' do
72
    it "hammer -v csv:puppetenvironments --csv-file test/data/puppetenvironments.csv" do
73
      stdout,stderr = capture {
74
        hammer.run(%W{-v csv:puppetenvironments --csv-file test/data/puppetenvironments.csv})
75
      }
76
      stderr.must_equal ''
77
      stdout.must_match /.*environment 'Development'.*/
78
    end
79
  end
80

    
81
  context 'Setup' do
82
    it "hammer -v csv:hosts --csv-file test/data/hosts.csv" do
83
      stdout,stderr = capture {
84
        hammer.run(%W{-v csv:hosts --csv-file test/data/hosts.csv})
85
      }
86
      stderr.must_equal ''
87
      stdout.split("\n").length.must_equal 255
88
      stdout.must_match /.*host 'dhcp129-000\.megacorp\.com'.*/
89
    end
90
  end
91

    
92
  context 'Setup' do
93
    it "hammer -v csv:puppetfacts --csv-file test/data/puppetfacts.csv" do
94
      stdout,stderr = capture {
95
        hammer.run(%W{-v csv:puppetfacts --csv-file test/data/puppetfacts.csv})
96
      }
97
      stderr.must_equal ''
98
      stdout.must_match /.*puppetfacts 'dhcp129-000.megacorp.com'.*/
99
    end
100
  end
101

    
102
  context 'subscription setup' do
103
    it "hammer -v subscription upload --organization-id megacorp --file test/data/megacorp.zip" do
104
      stdout,stderr = capture {
105
        hammer.run(%W{-v subscription upload --organization-id megacorp --file test/data/megacorp.zip})
106
      }
107
      stderr.must_equal ''
108
      stdout.must_match '.*Manifest is being uploaded.*'
109
    end
110
  end
111

    
112
  context 'Setup' do
113
    it "hammer -v csv:products --csv-file test/data/products.csv" do
114
      stdout,stderr = capture {
115
        hammer.run(%W{-v csv:products --csv-file test/data/products.csv})
116
      }
117
      stderr.must_equal ''
118
      stdout.must_match /.*product 'Point of Sale'.*/
119
    end
120
  end
121

    
122
  context 'Setup' do
123
    it "hammer -v csv:lifecycleenv --csv-file test/data/lifecycleenvironments.csv" do
124
      stdout,stderr = capture {
125
        hammer.run(%W{-v csv:lifecycleenv --csv-file test/data/lifecycleenvironments.csv})
126
      }
127
      stderr.must_equal ''
128
      stdout.must_match /.*xxx.*/
129
    end
130
  end
131

    
132
  context 'Setup' do
133
    it "hammer -v csv:systemgroups --csv-file test/data/systemgroups.csv" do
134
      stdout,stderr = capture {
135
        hammer.run(%W{-v csv:systemgroups --csv-file test/data/systemgroups.csv})
136
      }
137
      stderr.must_equal ''
138
      stdout.must_match /.*system group 'Mega Corp HQ'.*/
139
    end
140
  end
141

    
142
  context 'Setup' do
143
    it "hammer -v csv:systems --csv-file test/data/systems.csv" do
144
      stdout,stderr = capture {
145
        hammer.run(%W{-v csv:systems --csv-file test/data/systems.csv})
146
      }
147
      stderr.must_equal ''
148
      stdout.must_match /.*system 'host0'.*/
149
    end
150
  end
151

    
152
  context 'Setup' do
153
    it "hammer -v csv:activationkeys --csv-file test/data/activationkeys.csv" do
154
      stdout,stderr = capture {
155
        hammer.run(%W{-v csv:activationkeys --csv-file test/data/activationkeys.csv})
156
      }
157
      stderr.must_equal ''
158
      stdout.must_match /.*activation key 'damon\.dials@megacorp\.com'.*/
159
    end
160
  end
161

    
162
end