Project

General

Profile

Revision b923e753

Added by Thomas McKay over 6 years ago

new search content-hosts test

View differences:

test/resources/content_hosts_test.rb
122 122

  
123 123
      stop_vcr
124 124
    end
125

  
126
    def test_import_search
127
      start_vcr
128
      set_user 'admin'
129

  
130
      file = Tempfile.new('content_hosts_test')
131
      # rubocop:disable LineLength
132
      file.write("Name,Count,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions\n")
133
      file.write("testaaa%d,2,Test Corporation,Library,Default Organization View,,No,,RHEL 6.4,x86_64,2,4 GB,4,Standard,\"69|Red Hat Enterprise Linux Server\",\n")
134
      file.write("testbbb%d,3,Test Corporation,Library,Default Organization View,,No,,RHEL 6.4,x86_64,4,16 GB,8,Premium,\"69|Red Hat Enterprise Linux Server\",\n")
135
      # rubocop:enable LineLength
136
      file.rewind
137

  
138
      stdout,stderr = capture {
139
        hammer.run(%W{--reload-cache csv content-hosts --verbose --file #{file.path}})
140
      }
141
      assert_equal '', stderr
142

  
143
      file = Tempfile.new('content_hosts_test')
144
      # rubocop:disable LineLength
145
      file.write("Search,Organization,Environment,Content View,Host Collections,Virtual,Host,OS,Arch,Sockets,RAM,Cores,SLA,Products,Subscriptions\n")
146
      file.write("name ~ testaaa,Test Corporation,Library,Default Organization View,,No,,RHEL 6.4,x86_64,2,4 GB,4,Standard,\"69|Red Hat Enterprise Linux Server\",\"\"\"2|RH00004|Red Hat Enterprise Linux Server, Standard (Physical or Virtual Nodes)|10999113|5700573\"\"\"\n")
147
      # rubocop:enable LineLength
148
      file.rewind
149

  
150
      stdout,stderr = capture {
151
        hammer.run(%W{--reload-cache csv content-hosts --verbose --file #{file.path}})
152
      }
153
      assert_equal '', stderr
154
      assert_equal "Updating content host 'testaaa0'...done\nUpdating content host 'testaaa1'...done\n", stdout
155

  
156

  
157
      %w{testaaa0 testaaa1 testbbb0 testbbb1 testbbb2}.each do |hostname|
158
        host_delete(hostname)
159
      end
160

  
161
      stop_vcr
162
    end
125 163
  end
126 164
end

Also available in: Unified diff