Project

General

Profile

« Previous | Next » 

Revision 404ead2a

Added by Marek Hulán over 7 years ago

Fixes #17403 - enable exporting of templates

View differences:

test/models/provisioning_template_test.rb
TemplatesController.any_instance.expects(:render_safe).with(anything, includes(*Foreman::Renderer::ALLOWED_GENERIC_HELPERS), anything).returns(true)
ProvisioningTemplate.build_pxe_default(TemplatesController.new)
end
test "#metadata should include OSes and kind" do
template = FactoryGirl.build(:provisioning_template, :operatingsystems => [
FactoryGirl.create(:operatingsystem, :name => 'CentOS'),
FactoryGirl.create(:operatingsystem, :name => 'CentOS'),
FactoryGirl.create(:operatingsystem, :name => 'Fedora')])
lines = template.metadata.split("\n")
assert_includes lines, '- CentOS'
assert_includes lines, '- Fedora'
assert_equal 1, lines.select { |l| l == '- CentOS' }.size
assert_includes lines, "kind: #{template.template_kind.name}"
assert_includes lines, "name: #{template.name}"
end
end
end

Also available in: Unified diff