Sha256: 683d102d1ad2076151ed1379ee053f089a2a782c211a294a585b1417a06a9e8e

Contents?: true

Size: 1.19 KB

Versions: 7

Compression:

Stored size: 1.19 KB

Contents

require 'test_helper'

module ForemanBootdiskTestHelper
  def setup_bootdisk
    setup_routes
    setup_settings
    setup_templates
  end

  def setup_host_env
    setup_org_loc
    setup_subnet
    setup_host
  end

  def setup_routes
    @routes = ForemanBootdisk::Engine.routes
  end

  def setup_settings
    Setting::Bootdisk.load_defaults
  end

  def setup_templates
    load File.join(File.dirname(__FILE__), '..', 'db', 'seeds.d', '50-bootdisk_templates.rb')
  end

  def setup_referer
    request.env["HTTP_REFERER"] = "/history"
  end

  def setup_org_loc
    disable_orchestration
    @org, @loc = FactoryBot.create(:organization), FactoryBot.create(:location)
  end

  def setup_subnet
    tftp_proxy = FactoryBot.create(:smart_proxy, :features => [FactoryBot.create(:tftp_feature)])
    setup_subnet_no_tftp.update! :tftp => tftp_proxy
  end

  def setup_subnet_no_tftp
    @subnet = FactoryBot.create(:subnet_ipv4, :gateway => '10.0.1.254', :dns_primary => '8.8.8.8', :organizations => [@org], :locations => [@loc])
  end

  def setup_host
    @host = FactoryBot.create(:host, :managed, :subnet => @subnet, :ip => @subnet.network.sub(/0$/, '4'), :organization => @org, :location => @loc)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_bootdisk-12.0.1 test/test_plugin_helper.rb
foreman_bootdisk-13.0.0 test/test_plugin_helper.rb
foreman_bootdisk-12.0.0 test/test_plugin_helper.rb
foreman_bootdisk-11.0.0 test/test_plugin_helper.rb
foreman_bootdisk-10.0.2 test/test_plugin_helper.rb
foreman_bootdisk-10.0.1 test/test_plugin_helper.rb
foreman_bootdisk-10.0.0 test/test_plugin_helper.rb