Sha256: 33fb46b7a869b68766b33775fada727c06e94b279ea23c6fbe349b469b503efc

Contents?: true

Size: 1014 Bytes

Versions: 5

Compression:

Stored size: 1014 Bytes

Contents

# frozen_string_literal: true

require 'test_plugin_helper'

module ForemanBootdisk
  class RendererTest < ActiveSupport::TestCase
    include ForemanBootdiskTestHelper

    setup do
      User.current = users(:admin)
      setup_bootdisk
    end

    let(:renderer) { ForemanBootdisk::Renderer.new }

    describe 'a generic template' do
      test 'can be rendered' do
        rendered_template = renderer.generic_template_render
        assert_includes rendered_template, 'ifstat'
      end

      test 'does not include a host token' do
        rendered_template = renderer.generic_template_render
        assert_includes rendered_template, 'http://foreman.some.host.fqdn/unattended/iPXE?mac=${net0/mac}'
        assert_not_includes rendered_template, 'token'
      end
    end

    context 'with a subnet' do
      let(:subnet) { FactoryBot.create(:subnet_ipv4) }
      test 'renders a subnet template' do
        assert_includes renderer.generic_template_render(subnet), 'ifstat'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_bootdisk-16.1.0 test/unit/foreman_bootdisk/renderer_test.rb
foreman_bootdisk-16.0.0 test/unit/foreman_bootdisk/renderer_test.rb
foreman_bootdisk-15.1.0 test/unit/foreman_bootdisk/renderer_test.rb
foreman_bootdisk-15.0.0 test/unit/foreman_bootdisk/renderer_test.rb
foreman_bootdisk-14.0.0 test/unit/foreman_bootdisk/renderer_test.rb