Sha256: efde449f945ee686b4f5af4c21f30edcab9db8618b5d035d874b5d4a73b63b23
Contents?: true
Size: 1.17 KB
Versions: 41
Compression:
Stored size: 1.17 KB
Contents
require 'test_plugin_helper' class MetadataGeneratorTest < ActiveSupport::TestCase setup do end test 'generates an empty report' do generator = ForemanInventoryUpload::Generators::Metadata.new json_str = generator.render do end actual = JSON.parse(json_str.join("\n")) assert_not_nil actual['report_id'] assert_equal 'Satellite', actual['source'] assert_equal({}, actual['report_slices']) end test 'generates a report for a single slice' do generator = ForemanInventoryUpload::Generators::Metadata.new json_str = generator.render do |gen| gen.add_slice('test_123', 1, true) gen.add_slice('test_1234', 2, false) gen.add_slice('test_12345', 3, false) end actual = JSON.parse(json_str.join("\n")) assert_not_nil actual['report_id'] assert_equal 'Satellite', actual['source'] assert_not_nil(slices = actual['report_slices']) assert_not_nil(slice = slices['test_123']) assert_equal 1, slice['number_hosts'] assert_not_nil(slice = slices['test_1234']) assert_equal 2, slice['number_hosts'] assert_not_nil(slice = slices['test_12345']) assert_equal 3, slice['number_hosts'] end end
Version data entries
41 entries across 41 versions & 2 rubygems