Sha256: 4a9f0532af8b210214a95d5297e7e9efb1c4dca5852855a51fcbbcad792c869a

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require 'test_plugin_helper'

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

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

  describe "#host" do
    setup :setup_org_loc
    setup :setup_subnet
    setup :setup_host

    test "should generate host image" do
      ForemanBootdisk::ISOGenerator.expects(:generate).with(has_entry(:ipxe => regexp_matches(/disk host template/))).yields("temp ISO")
      File.expects(:read).with("temp ISO").returns("ISO image")
      get :host, {:id => @host.name}
      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 :host, {:id => @host.name, :full => true}
      assert_response :success
      assert_equal "ISO image", @response.body
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_bootdisk-8.0.2 test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
foreman_bootdisk-8.0.1 test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
foreman_bootdisk-7.0.1 test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
foreman_bootdisk-8.0.0 test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
foreman_bootdisk-7.0.0 test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb
foreman_bootdisk-6.1.0 test/functional/foreman_bootdisk/api/v2/disks_controller_test.rb