Sha256: 73bd67f74307c84ff896565fed8d7da18a7cfc83f422b55b15e125a19171619e

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

require 'test_plugin_helper'

class ForemanBootdisk::DisksControllerTest < ActionController::TestCase
  setup :setup_bootdisk

  test "should generate generic image" do
    ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/generic host template/))).yields("temp ISO")
    File.expects(:read).with("temp ISO").returns("ISO image")
    get :generic, {}, set_session_user
    assert_response :success
    assert_equal "ISO image", @response.body
  end

  describe "#host" do
    setup :setup_host

    test "should generate host image" do
      ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/host template/))).yields("temp ISO")
      File.expects(:read).with("temp ISO").returns("ISO image")
      get :host, {:id => @host.name}, set_session_user
      assert_response :success
      assert_equal "ISO image", @response.body
    end

    test "should generate full host image" do
      ForemanBootdisk::ISOGenerator.expects(:generate_full_host).with(@host).yields("temp ISO")
      File.expects(:read).with("temp ISO").returns("ISO image")
      get :full_host, {:id => @host.name}, set_session_user
      assert_response :success
      assert_equal "ISO image", @response.body
    end
  end

  test "should render help" do
    get :help, {}, set_session_user
    assert_response :success
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_bootdisk-6.0.0 test/functional/foreman_bootdisk/disks_controller_test.rb
foreman_bootdisk-5.0.0 test/functional/foreman_bootdisk/disks_controller_test.rb
foreman_bootdisk-4.0.2 test/functional/foreman_bootdisk/disks_controller_test.rb