velir_virtualbox 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.yardopts +3 -0
- data/Gemfile +16 -0
- data/LICENSE +19 -0
- data/Rakefile +37 -0
- data/Readme.md +70 -0
- data/docs/GettingStarted.md +196 -0
- data/docs/WhatsNew.md +12 -0
- data/features/README.md +33 -0
- data/features/global.feature +19 -0
- data/features/global_extra_data.feature +27 -0
- data/features/step_definitions/abstract_model_steps.rb +39 -0
- data/features/step_definitions/extra_data_steps.rb +36 -0
- data/features/step_definitions/global_steps.rb +29 -0
- data/features/step_definitions/nat_engine_steps.rb +76 -0
- data/features/step_definitions/network_adapter_steps.rb +38 -0
- data/features/step_definitions/shared_folder_steps.rb +76 -0
- data/features/step_definitions/snapshot_steps.rb +74 -0
- data/features/step_definitions/storage_controller_steps.rb +16 -0
- data/features/step_definitions/virtualbox_steps.rb +17 -0
- data/features/step_definitions/vm_steps.rb +50 -0
- data/features/support/env.rb +61 -0
- data/features/support/helpers.rb +38 -0
- data/features/support/hooks.rb +30 -0
- data/features/support/ordered_hash.rb +49 -0
- data/features/support/vboxmanage.rb +191 -0
- data/features/version.feature +16 -0
- data/features/vm.feature +13 -0
- data/features/vm_bios.feature +29 -0
- data/features/vm_cpu.feature +29 -0
- data/features/vm_extra_data.feature +35 -0
- data/features/vm_hw_virt.feature +29 -0
- data/features/vm_nat_engine.feature +57 -0
- data/features/vm_network_adapters.feature +27 -0
- data/features/vm_shared_folders.feature +42 -0
- data/features/vm_snapshots.feature +29 -0
- data/features/vm_storage_controllers.feature +11 -0
- data/lib/virtualbox.rb +11 -0
- data/lib/virtualbox/abstract_model.rb +281 -0
- data/lib/virtualbox/abstract_model/attributable.rb +290 -0
- data/lib/virtualbox/abstract_model/dirty.rb +177 -0
- data/lib/virtualbox/abstract_model/interface_attributes.rb +98 -0
- data/lib/virtualbox/abstract_model/relatable.rb +332 -0
- data/lib/virtualbox/abstract_model/validatable.rb +167 -0
- data/lib/virtualbox/abstract_model/version_matcher.rb +35 -0
- data/lib/virtualbox/appliance.rb +62 -0
- data/lib/virtualbox/audio_adapter.rb +52 -0
- data/lib/virtualbox/bios.rb +50 -0
- data/lib/virtualbox/com.rb +23 -0
- data/lib/virtualbox/com/abstract_enum.rb +43 -0
- data/lib/virtualbox/com/abstract_implementer.rb +45 -0
- data/lib/virtualbox/com/abstract_interface.rb +167 -0
- data/lib/virtualbox/com/base_interface.rb +38 -0
- data/lib/virtualbox/com/ffi/interface.rb +150 -0
- data/lib/virtualbox/com/ffi/interfaces.rb +63 -0
- data/lib/virtualbox/com/ffi/util.rb +121 -0
- data/lib/virtualbox/com/ffi/vboxxpcomc.rb +31 -0
- data/lib/virtualbox/com/ffi_interface.rb +96 -0
- data/lib/virtualbox/com/implementer/base.rb +59 -0
- data/lib/virtualbox/com/implementer/ffi.rb +381 -0
- data/lib/virtualbox/com/implementer/mscom.rb +189 -0
- data/lib/virtualbox/com/implementer/nil.rb +10 -0
- data/lib/virtualbox/com/interface/3.1.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.1.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.1.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/guest_os_type.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/host.rb +42 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.1.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/machine.rb +105 -0
- data/lib/virtualbox/com/interface/3.1.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/medium.rb +50 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter.rb +30 -0
- data/lib/virtualbox/com/interface/3.1.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.1.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.1.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.1.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/system_properties.rb +37 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_controller.rb +20 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.1.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.1.x/vrdp_server.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/appliance.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/3.2.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/3.2.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/3.2.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/3.2.x/hw_virt_ex_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/machine.rb +118 -0
- data/lib/virtualbox/com/interface/3.2.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/medium.rb +51 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/3.2.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter.rb +34 -0
- data/lib/virtualbox/com/interface/3.2.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/3.2.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/progress.rb +63 -0
- data/lib/virtualbox/com/interface/3.2.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/3.2.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/3.2.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/virtualbox.rb +67 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/3.2.x/vrdp_server.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/access_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/appliance.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_adapter.rb +15 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/audio_driver_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/auth_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/bios_boot_menu_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/bios_settings.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/cleanup_mode.rb +12 -0
- data/lib/virtualbox/com/interface/4.0.x/clipboard_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/console.rb +50 -0
- data/lib/virtualbox/com/interface/4.0.x/cpu_property_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/device_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/dhcp_server.rb +22 -0
- data/lib/virtualbox/com/interface/4.0.x/event_source.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/fault_tolerance_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/firmware_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/guest.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/guest_os_type.rb +33 -0
- data/lib/virtualbox/com/interface/4.0.x/host.rb +43 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface.rb +30 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_status.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_network_interface_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/host_usb_device.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/host_usb_device_filter.rb +13 -0
- data/lib/virtualbox/com/interface/4.0.x/hw_virt_ex_property_type.rb +12 -0
- data/lib/virtualbox/com/interface/4.0.x/keyboard_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/lock_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/machine.rb +132 -0
- data/lib/virtualbox/com/interface/4.0.x/machine_state.rb +14 -0
- data/lib/virtualbox/com/interface/4.0.x/medium.rb +53 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_attachment.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_format.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/medium_variant.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_alias_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_engine.rb +27 -0
- data/lib/virtualbox/com/interface/4.0.x/nat_protocol.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/network_adapter.rb +35 -0
- data/lib/virtualbox/com/interface/4.0.x/network_adapter_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/network_attachment_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/nsiexception.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/nsisupports.rb +15 -0
- data/lib/virtualbox/com/interface/4.0.x/parallel_port.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/pointing_hid_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/port_mode.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/progress.rb +64 -0
- data/lib/virtualbox/com/interface/4.0.x/serial_port.rb +19 -0
- data/lib/virtualbox/com/interface/4.0.x/session.rb +18 -0
- data/lib/virtualbox/com/interface/4.0.x/session_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/session_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/shared_folder.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/snapshot.rb +20 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_bus.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_controller.rb +24 -0
- data/lib/virtualbox/com/interface/4.0.x/storage_controller_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/system_properties.rb +42 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_controller.rb +21 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device.rb +24 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_filter.rb +23 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_filter_action.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/usb_device_state.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_box_error_info.rb +17 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description.rb +19 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description_type.rb +14 -0
- data/lib/virtualbox/com/interface/4.0.x/virtual_system_description_value_type.rb +11 -0
- data/lib/virtualbox/com/interface/4.0.x/virtualbox.rb +50 -0
- data/lib/virtualbox/com/interface/4.0.x/vrde_server.rb +23 -0
- data/lib/virtualbox/com/mscom_interface.rb +44 -0
- data/lib/virtualbox/com/nil_interface.rb +7 -0
- data/lib/virtualbox/com/util.rb +32 -0
- data/lib/virtualbox/cpu.rb +61 -0
- data/lib/virtualbox/dhcp_server.rb +89 -0
- data/lib/virtualbox/dvd.rb +27 -0
- data/lib/virtualbox/exceptions.rb +39 -0
- data/lib/virtualbox/ext/byte_normalizer.rb +17 -0
- data/lib/virtualbox/ext/glob_loader.rb +35 -0
- data/lib/virtualbox/ext/logger.rb +38 -0
- data/lib/virtualbox/ext/platform.rb +31 -0
- data/lib/virtualbox/ext/subclass_listing.rb +24 -0
- data/lib/virtualbox/extra_data.rb +127 -0
- data/lib/virtualbox/forwarded_port.rb +222 -0
- data/lib/virtualbox/global.rb +96 -0
- data/lib/virtualbox/hard_drive.rb +246 -0
- data/lib/virtualbox/host.rb +71 -0
- data/lib/virtualbox/host_network_interface.rb +137 -0
- data/lib/virtualbox/hw_virtualization.rb +64 -0
- data/lib/virtualbox/lib.rb +84 -0
- data/lib/virtualbox/media.rb +20 -0
- data/lib/virtualbox/medium.rb +145 -0
- data/lib/virtualbox/medium_attachment.rb +61 -0
- data/lib/virtualbox/nat_engine.rb +71 -0
- data/lib/virtualbox/nat_forwarded_port.rb +171 -0
- data/lib/virtualbox/network_adapter.rb +166 -0
- data/lib/virtualbox/proxies/collection.rb +57 -0
- data/lib/virtualbox/shared_folder.rb +220 -0
- data/lib/virtualbox/snapshot.rb +185 -0
- data/lib/virtualbox/storage_controller.rb +160 -0
- data/lib/virtualbox/system_properties.rb +73 -0
- data/lib/virtualbox/usb_controller.rb +59 -0
- data/lib/virtualbox/usb_device_filter.rb +74 -0
- data/lib/virtualbox/version.rb +36 -0
- data/lib/virtualbox/virtual_system_description.rb +47 -0
- data/lib/virtualbox/vm.rb +649 -0
- data/lib/virtualbox/vrde_server.rb +57 -0
- data/test/test_helper.rb +18 -0
- data/test/virtualbox/abstract_model/attributable_test.rb +269 -0
- data/test/virtualbox/abstract_model/dirty_test.rb +83 -0
- data/test/virtualbox/abstract_model/interface_attributes_test.rb +194 -0
- data/test/virtualbox/abstract_model/relatable_test.rb +348 -0
- data/test/virtualbox/abstract_model/validatable_test.rb +308 -0
- data/test/virtualbox/abstract_model/version_matcher_test.rb +41 -0
- data/test/virtualbox/abstract_model_test.rb +462 -0
- data/test/virtualbox/appliance_test.rb +159 -0
- data/test/virtualbox/audio_adapter_test.rb +83 -0
- data/test/virtualbox/bios_test.rb +83 -0
- data/test/virtualbox/com/abstract_enum_test.rb +49 -0
- data/test/virtualbox/com/abstract_implementer_test.rb +40 -0
- data/test/virtualbox/com/abstract_interface_test.rb +140 -0
- data/test/virtualbox/com/ffi/interface_test.rb +249 -0
- data/test/virtualbox/com/ffi/util_test.rb +108 -0
- data/test/virtualbox/com/ffi_interface_test.rb +42 -0
- data/test/virtualbox/com/implementer/base_test.rb +38 -0
- data/test/virtualbox/com/implementer/ffi_test.rb +527 -0
- data/test/virtualbox/com/implementer/mscom_test.rb +247 -0
- data/test/virtualbox/com/mscom_interface_test.rb +17 -0
- data/test/virtualbox/com/util_test.rb +17 -0
- data/test/virtualbox/cpu_test.rb +103 -0
- data/test/virtualbox/dhcp_server_test.rb +165 -0
- data/test/virtualbox/dvd_test.rb +28 -0
- data/test/virtualbox/ext/byte_normalizer_test.rb +34 -0
- data/test/virtualbox/ext/platform_test.rb +50 -0
- data/test/virtualbox/ext/subclass_listing_test.rb +25 -0
- data/test/virtualbox/extra_data_test.rb +155 -0
- data/test/virtualbox/forwarded_port_test.rb +286 -0
- data/test/virtualbox/global_test.rb +46 -0
- data/test/virtualbox/hard_drive_test.rb +141 -0
- data/test/virtualbox/host_network_interface_test.rb +255 -0
- data/test/virtualbox/host_test.rb +94 -0
- data/test/virtualbox/hw_virtualization_test.rb +103 -0
- data/test/virtualbox/lib_test.rb +93 -0
- data/test/virtualbox/medium_attachment_test.rb +147 -0
- data/test/virtualbox/medium_test.rb +192 -0
- data/test/virtualbox/nat_engine_test.rb +106 -0
- data/test/virtualbox/nat_forwarded_port_test.rb +222 -0
- data/test/virtualbox/network_adapter_test.rb +191 -0
- data/test/virtualbox/proxies/collection_test.rb +102 -0
- data/test/virtualbox/shared_folder_test.rb +219 -0
- data/test/virtualbox/snapshot_test.rb +231 -0
- data/test/virtualbox/storage_controller_test.rb +197 -0
- data/test/virtualbox/system_properties_test.rb +87 -0
- data/test/virtualbox/usb_controller_test.rb +112 -0
- data/test/virtualbox/usb_device_filter_test.rb +93 -0
- data/test/virtualbox/version_test.rb +59 -0
- data/test/virtualbox/virtual_system_description_test.rb +61 -0
- data/test/virtualbox/vm_test.rb +633 -0
- data/test/virtualbox/vrde_server_test.rb +83 -0
- data/test/virtualbox_test.rb +11 -0
- data/virtualbox.gemspec +24 -0
- metadata +464 -0
@@ -0,0 +1,247 @@
|
|
1
|
+
require File.expand_path("../../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class COMImplementerMSCOMTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::COM::Implementer::MSCOM
|
6
|
+
@interface = mock("interface")
|
7
|
+
@lib = mock("lib")
|
8
|
+
@object = mock("object")
|
9
|
+
end
|
10
|
+
|
11
|
+
context "initializing" do
|
12
|
+
should "make the lib base and object accessible" do
|
13
|
+
instance = @klass.new(@interface, @lib, @object)
|
14
|
+
assert_equal @lib, instance.lib
|
15
|
+
assert_equal @object, instance.object
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "with an instance" do
|
20
|
+
setup do
|
21
|
+
@instance = @klass.new(@interface, @lib, @object)
|
22
|
+
end
|
23
|
+
|
24
|
+
context "spec to formal argument list" do
|
25
|
+
should "replace primitives with their types" do
|
26
|
+
assert_equal [7], @instance.spec_to_args([:int], [7])
|
27
|
+
end
|
28
|
+
|
29
|
+
should "replace booleans with 1/0" do
|
30
|
+
bool = VirtualBox::COM::T_BOOL
|
31
|
+
assert_equal [1,0], @instance.spec_to_args([bool, bool], [true, false])
|
32
|
+
end
|
33
|
+
|
34
|
+
should "convert interfaces with nil arguments to nil" do
|
35
|
+
spec = [:Machine]
|
36
|
+
args = [nil]
|
37
|
+
|
38
|
+
assert_equal [nil], @instance.spec_to_args(spec, args)
|
39
|
+
end
|
40
|
+
|
41
|
+
should "convert enums to their property indices" do
|
42
|
+
spec = [:FirmwareType]
|
43
|
+
args = [:efi]
|
44
|
+
|
45
|
+
assert_equal [1], @instance.spec_to_args(spec, args)
|
46
|
+
end
|
47
|
+
|
48
|
+
should "ignore out parameters" do
|
49
|
+
spec = [[:out, :hey], :int]
|
50
|
+
args = [7]
|
51
|
+
|
52
|
+
assert_equal [7], @instance.spec_to_args(spec, args)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "reading a property" do
|
57
|
+
context "with ruby 1.8" do
|
58
|
+
setup do
|
59
|
+
@instance.stubs(:ruby_version).returns(1.8)
|
60
|
+
end
|
61
|
+
|
62
|
+
should "read the property on the object and return it" do
|
63
|
+
name = :foo_bar
|
64
|
+
value = mock("value")
|
65
|
+
result = mock("result")
|
66
|
+
opts = { :value_type => :foo }
|
67
|
+
@object.expects(:[]).with('FooBar').once.returns(value)
|
68
|
+
@instance.expects(:returnable_value).with(value, opts[:value_type]).returns(result)
|
69
|
+
|
70
|
+
assert_equal result, @instance.read_property(name, opts)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "with ruby 1.9" do
|
75
|
+
setup do
|
76
|
+
@instance.stubs(:ruby_version).returns(1.9)
|
77
|
+
end
|
78
|
+
|
79
|
+
should "read the property on the object and return it" do
|
80
|
+
name = :foo_bar
|
81
|
+
value = mock("value")
|
82
|
+
result = mock("result")
|
83
|
+
opts = { :value_type => :foo }
|
84
|
+
@object.expects(:FooBar).once.returns(value)
|
85
|
+
@instance.expects(:returnable_value).with(value, opts[:value_type]).returns(result)
|
86
|
+
|
87
|
+
assert_equal result, @instance.read_property(name, opts)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "writing a property" do
|
93
|
+
context "on ruby 1.8" do
|
94
|
+
setup do
|
95
|
+
@instance.stubs(:ruby_version).returns(1.8)
|
96
|
+
end
|
97
|
+
|
98
|
+
should "convert the args and set it on the object" do
|
99
|
+
name = :foo_bar
|
100
|
+
opts = { :value_type => :foo }
|
101
|
+
@instance.expects(:spec_to_args).with([:foo], [:value]).returns([:modified])
|
102
|
+
@object.expects(:[]=).with('FooBar', :modified).once
|
103
|
+
|
104
|
+
@instance.write_property(name, :value, opts)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context "on ruby 1.9" do
|
109
|
+
setup do
|
110
|
+
@instance.stubs(:ruby_version).returns(1.9)
|
111
|
+
end
|
112
|
+
|
113
|
+
should "convert the args and set it on the object" do
|
114
|
+
name = :foo_bar
|
115
|
+
opts = { :value_type => :foo }
|
116
|
+
@instance.expects(:spec_to_args).with([:foo], [:value]).returns([:modified])
|
117
|
+
@object.expects(:FooBar=).with(:modified).once
|
118
|
+
|
119
|
+
@instance.write_property(name, :value, opts)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "calling a function" do
|
125
|
+
should "send the method and args to the object and return the value" do
|
126
|
+
name = :foo_bar
|
127
|
+
args = [1,2,3]
|
128
|
+
formal_args = [4,5,6]
|
129
|
+
result = mock("result")
|
130
|
+
value = mock("value")
|
131
|
+
opts = { :value_type => :foo, :spec => :foo }
|
132
|
+
@object.expects(:send).with('FooBar', *formal_args).once.returns(value)
|
133
|
+
@instance.expects(:spec_to_args).with(opts[:spec], args).returns(formal_args)
|
134
|
+
@instance.expects(:returnable_value).with(value, opts[:value_type]).returns(result)
|
135
|
+
|
136
|
+
assert_equal result, @instance.call_function(name, args, opts)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "returnable values" do
|
141
|
+
should "just return nil if type is nil" do
|
142
|
+
assert_nil @instance.returnable_value(7, nil)
|
143
|
+
end
|
144
|
+
|
145
|
+
should "just return nil if type is void" do
|
146
|
+
assert_nil @instance.returnable_value(7, :void)
|
147
|
+
end
|
148
|
+
|
149
|
+
should "infer the type then attempt to read that type" do
|
150
|
+
@instance.expects(:infer_type).with(:bar).returns([nil, :foo])
|
151
|
+
@instance.expects(:read_foo).with(7, :bar).once
|
152
|
+
@instance.returnable_value(7, :bar)
|
153
|
+
end
|
154
|
+
|
155
|
+
should "infer type and call array method for arrays" do
|
156
|
+
@instance.expects(:infer_type).with(:bar).returns([nil, :foo])
|
157
|
+
@instance.expects(:read_array_of_foo).with(7, [:bar]).once
|
158
|
+
@instance.returnable_value(7, [:bar])
|
159
|
+
end
|
160
|
+
|
161
|
+
should "return the value of the read method" do
|
162
|
+
result = mock("result")
|
163
|
+
@instance.expects(:infer_type).with(:bar).returns([nil, :foo])
|
164
|
+
@instance.expects(:read_foo).with(7, :bar).once.returns(result)
|
165
|
+
assert_equal result, @instance.returnable_value(7, :bar)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
context "reading primitive values" do
|
170
|
+
# Yes, it typically avoid meta-programming, but this is such a
|
171
|
+
# repetitive and simple case that I am doing it
|
172
|
+
[:ushort, :uint, :ulong, :int, :long].each do |prim|
|
173
|
+
should "read #{prim} and convert to int" do
|
174
|
+
assert_equal 7, @instance.send("read_#{prim}".to_sym, "7", prim)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
should "return strings as is" do
|
179
|
+
assert_equal "foo", @instance.read_unicode_string("foo", :unicode_string)
|
180
|
+
end
|
181
|
+
|
182
|
+
should "read char as a boolean value" do
|
183
|
+
assert_equal true, @instance.read_char('1', :char)
|
184
|
+
assert_equal false, @instance.read_char('0', :char)
|
185
|
+
assert_equal true, @instance.read_char(1, :char)
|
186
|
+
assert_equal false, @instance.read_char(0, :char)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
context "reading enums" do
|
191
|
+
setup do
|
192
|
+
@interface_klass = mock("klass")
|
193
|
+
|
194
|
+
@type = :foo
|
195
|
+
@value = :bar
|
196
|
+
@result = mock("result")
|
197
|
+
end
|
198
|
+
|
199
|
+
should "index the value on the interface class" do
|
200
|
+
@instance.expects(:interface_klass).with(@type).returns(@interface_klass)
|
201
|
+
@interface_klass.expects(:[]).with(@value).returns(@result)
|
202
|
+
|
203
|
+
assert_equal @result, @instance.read_enum(@value, @type)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "reading interfaces" do
|
208
|
+
setup do
|
209
|
+
@interface_klass = mock("klass")
|
210
|
+
|
211
|
+
@type = :foo
|
212
|
+
@value = :bar
|
213
|
+
@result = mock("result")
|
214
|
+
end
|
215
|
+
|
216
|
+
should "instantiate the klass properly" do
|
217
|
+
@instance.expects(:interface_klass).with(@type).returns(@interface_klass)
|
218
|
+
@interface_klass.expects(:new).with(@instance.class, @instance.lib, @value).returns(@result)
|
219
|
+
|
220
|
+
assert_equal @result, @instance.read_interface(@value, @type)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
context "reading an array of strings" do
|
225
|
+
should "just return as is" do
|
226
|
+
assert_equal ["foo", "bar"], @instance.read_array_of_unicode_string(["foo", "bar"], :unicode_string)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
context "read array of interface" do
|
231
|
+
setup do
|
232
|
+
@interface_klass = mock("klass")
|
233
|
+
|
234
|
+
@type = :foo
|
235
|
+
@value = [:foo, nil]
|
236
|
+
@result = mock("result")
|
237
|
+
end
|
238
|
+
|
239
|
+
should "instantiate the klass properly for non-nil values" do
|
240
|
+
@instance.expects(:interface_klass).with(@type).returns(@interface_klass)
|
241
|
+
@interface_klass.expects(:new).with(@instance.class, @instance.lib, @value[0]).returns(@result)
|
242
|
+
|
243
|
+
assert_equal [@result, nil], @instance.read_array_of_interface(@value, [@type])
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class COMMSCOMInterfaceBaseTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::COM::MSCOMInterface
|
6
|
+
end
|
7
|
+
context "initialization" do
|
8
|
+
should "initialize MSCOM interface" do
|
9
|
+
@klass.any_instance.expects(:initialize_mscom).once
|
10
|
+
@klass.new
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context "initializing mscom interface" do
|
15
|
+
# TODO
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path("../../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class COMUtilTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::COM::Util
|
6
|
+
end
|
7
|
+
|
8
|
+
context "checking for interfaces" do
|
9
|
+
should "return true for existing interfaces" do
|
10
|
+
assert @klass.interface?(:VirtualBox)
|
11
|
+
end
|
12
|
+
|
13
|
+
should "return false for non-existing interfaces" do
|
14
|
+
assert !@klass.interface?(:IDontExist)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class CPUTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@klass = VirtualBox::CPU
|
6
|
+
@interface = mock("interface")
|
7
|
+
@parent = mock("parent")
|
8
|
+
end
|
9
|
+
|
10
|
+
context "class methods" do
|
11
|
+
context "populating relationship" do
|
12
|
+
setup do
|
13
|
+
@instance = mock("instance")
|
14
|
+
@klass.stubs(:new).returns(@instance)
|
15
|
+
end
|
16
|
+
|
17
|
+
should "call new for the interface" do
|
18
|
+
@klass.expects(:new).with(nil, @interface).once.returns(@instance)
|
19
|
+
assert_equal @instance, @klass.populate_relationship(nil, @interface)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "saving relationship" do
|
24
|
+
should "call save with the interface on the instance" do
|
25
|
+
instance = mock("instance")
|
26
|
+
instance.expects(:save).once
|
27
|
+
|
28
|
+
@klass.save_relationship(nil, instance)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "initializing" do
|
34
|
+
setup do
|
35
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
36
|
+
end
|
37
|
+
|
38
|
+
should "load interface attribtues" do
|
39
|
+
@klass.any_instance.expects(:load_interface_attributes).with(@interface).once
|
40
|
+
@klass.new(@parent, @interface)
|
41
|
+
end
|
42
|
+
|
43
|
+
should "not be dirty" do
|
44
|
+
@instance = @klass.new(@parent, @interface)
|
45
|
+
assert !@instance.changed?
|
46
|
+
end
|
47
|
+
|
48
|
+
should "be existing record" do
|
49
|
+
@instance = @klass.new(@parent, @interface)
|
50
|
+
assert !@instance.new_record?
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "instance methods" do
|
55
|
+
setup do
|
56
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
57
|
+
|
58
|
+
@parent = mock("parent")
|
59
|
+
@interface = mock("interface")
|
60
|
+
@instance = @klass.new(@parent, @interface)
|
61
|
+
end
|
62
|
+
|
63
|
+
context "getting a property" do
|
64
|
+
setup do
|
65
|
+
@key = :foo
|
66
|
+
end
|
67
|
+
|
68
|
+
should "call proper function on interface" do
|
69
|
+
result = mock("result")
|
70
|
+
@interface.expects(:get_cpu_property).with(@key).returns(result)
|
71
|
+
assert_equal result, @instance.get_property(@interface, @key)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "setting a property" do
|
76
|
+
setup do
|
77
|
+
@key = :foo
|
78
|
+
@value = :bar
|
79
|
+
end
|
80
|
+
|
81
|
+
should "call proper function on interface" do
|
82
|
+
@interface.expects(:set_cpu_property).with(@key, @value).once
|
83
|
+
@instance.set_property(@interface, @key, @value)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "saving" do
|
88
|
+
setup do
|
89
|
+
@bios_settings = mock("bios_settings")
|
90
|
+
@session = mock("session")
|
91
|
+
@machine = mock("machine")
|
92
|
+
@session.stubs(:machine).returns(@machine)
|
93
|
+
@parent.stubs(:with_open_session).yields(@session)
|
94
|
+
end
|
95
|
+
|
96
|
+
should "save the interface settings with the new bios settings" do
|
97
|
+
save_seq = sequence("save_seq")
|
98
|
+
@instance.expects(:save_changed_interface_attributes).with(@machine).once.in_sequence(save_seq)
|
99
|
+
@instance.save
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
require File.expand_path("../../test_helper", __FILE__)
|
2
|
+
|
3
|
+
class DHCPServerTest < Test::Unit::TestCase
|
4
|
+
setup do
|
5
|
+
@interface = mock("interface")
|
6
|
+
@parent = mock("parent")
|
7
|
+
|
8
|
+
@klass = VirtualBox::DHCPServer
|
9
|
+
end
|
10
|
+
|
11
|
+
context "class methods" do
|
12
|
+
context "populating relationships" do
|
13
|
+
setup do
|
14
|
+
@instance = mock("instance")
|
15
|
+
@klass.stubs(:new).returns(@instance)
|
16
|
+
end
|
17
|
+
|
18
|
+
should "return a proxied collection" do
|
19
|
+
result = @klass.populate_relationship(nil, [])
|
20
|
+
assert result.is_a?(VirtualBox::Proxies::Collection)
|
21
|
+
end
|
22
|
+
|
23
|
+
should "call new for every interface" do
|
24
|
+
collection = []
|
25
|
+
5.times { |i| collection << mock("a#{i}") }
|
26
|
+
|
27
|
+
expected_result = []
|
28
|
+
new_seq = sequence("new_seq")
|
29
|
+
collection.each do |item|
|
30
|
+
expected_value = "instance-#{item.inspect}"
|
31
|
+
@klass.expects(:new).with(item).in_sequence(new_seq).returns(expected_value)
|
32
|
+
expected_result << expected_value
|
33
|
+
end
|
34
|
+
|
35
|
+
assert_equal expected_result, @klass.populate_relationship(@parent, collection)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "creating" do
|
40
|
+
setup do
|
41
|
+
@lib = mock("lib")
|
42
|
+
@virtualbox = mock("virtualbox")
|
43
|
+
@proxy = mock("proxy")
|
44
|
+
|
45
|
+
@lib.stubs(:virtualbox).returns(@virtualbox)
|
46
|
+
@parent.stubs(:lib).returns(@lib)
|
47
|
+
@proxy.stubs(:parent).returns(@parent)
|
48
|
+
end
|
49
|
+
|
50
|
+
should "create the dhcp server" do
|
51
|
+
name = :foo
|
52
|
+
interface = mock("interface")
|
53
|
+
result = mock("result")
|
54
|
+
@virtualbox.expects(:create_dhcp_server).with(name).once.returns(interface)
|
55
|
+
@klass.expects(:new).with(interface).returns(result)
|
56
|
+
assert_equal result, @klass.create(@proxy, name)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "initializing" do
|
62
|
+
should "load attributes from the machine" do
|
63
|
+
@klass.any_instance.expects(:initialize_attributes).with(@interface).once
|
64
|
+
@klass.new(@interface)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "initializing attributes" do
|
69
|
+
setup do
|
70
|
+
@klass.any_instance.stubs(:load_interface_attributes)
|
71
|
+
end
|
72
|
+
|
73
|
+
should "load interface attribtues" do
|
74
|
+
@klass.any_instance.expects(:load_interface_attributes).with(@interface).once
|
75
|
+
@klass.new(@interface)
|
76
|
+
end
|
77
|
+
|
78
|
+
should "be existing record" do
|
79
|
+
@instance = @klass.new(@interface)
|
80
|
+
assert !@instance.new_record?
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context "instance methods" do
|
85
|
+
setup do
|
86
|
+
@klass.any_instance.stubs(:initialize_attributes)
|
87
|
+
|
88
|
+
@parent = mock("parent")
|
89
|
+
@interface = mock("interface")
|
90
|
+
@instance = @klass.new(@interface)
|
91
|
+
@instance.stubs(:interface).returns(@interface)
|
92
|
+
@collection = VirtualBox::Proxies::Collection.new(@parent)
|
93
|
+
@collection << @instance
|
94
|
+
end
|
95
|
+
|
96
|
+
context "saving" do
|
97
|
+
setup do
|
98
|
+
@instance.stubs(:save_changed_interface_attributes)
|
99
|
+
end
|
100
|
+
|
101
|
+
should "set configuration if something changed" do
|
102
|
+
@instance.ip_address = "7"
|
103
|
+
@interface.expects(:set_configuration).once
|
104
|
+
@instance.save
|
105
|
+
end
|
106
|
+
|
107
|
+
should "not set configuration if nothing changed" do
|
108
|
+
@interface.expects(:set_configuration).never
|
109
|
+
@instance.save
|
110
|
+
end
|
111
|
+
|
112
|
+
should "save the changed attributes" do
|
113
|
+
@instance.expects(:save_changed_interface_attributes).with(@instance.interface).once
|
114
|
+
@instance.save
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context "destroying" do
|
119
|
+
setup do
|
120
|
+
@lib = mock("lib")
|
121
|
+
@virtualbox = mock("virtualbox")
|
122
|
+
@lib.stubs(:virtualbox).returns(@virtualbox)
|
123
|
+
@parent.stubs(:lib).returns(@lib)
|
124
|
+
|
125
|
+
@virtualbox.stubs(:remove_dhcp_server)
|
126
|
+
end
|
127
|
+
|
128
|
+
should "destroy the DHCP server" do
|
129
|
+
@virtualbox.expects(:remove_dhcp_server).with(@interface).once
|
130
|
+
@instance.destroy
|
131
|
+
end
|
132
|
+
|
133
|
+
should "remove from collection" do
|
134
|
+
assert @collection.include?(@instance)
|
135
|
+
@instance.destroy
|
136
|
+
assert !@collection.include?(@instance)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "host network" do
|
141
|
+
setup do
|
142
|
+
@host = mock("host")
|
143
|
+
@network_interfaces = []
|
144
|
+
@parent.stubs(:host).returns(@host)
|
145
|
+
@host.stubs(:network_interfaces).returns(@network_interfaces)
|
146
|
+
end
|
147
|
+
|
148
|
+
should "do nothing if not a DHCP server for a host interface" do
|
149
|
+
@instance.stubs(:network_name).returns("foo")
|
150
|
+
assert_nil @instance.host_network
|
151
|
+
end
|
152
|
+
|
153
|
+
should "return the matching network interface" do
|
154
|
+
name = "foo"
|
155
|
+
ni = mock("net_interface")
|
156
|
+
ni.stubs(:interface_type).returns(:host_only)
|
157
|
+
ni.stubs(:name).returns(name)
|
158
|
+
|
159
|
+
@network_interfaces << ni
|
160
|
+
@instance.stubs(:network_name).returns("HostInterfaceNetworking-#{name}")
|
161
|
+
assert_equal ni, @instance.host_network
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|