Skip to content

Commit

Permalink
Merge pull request #167 from jntullo/bug/vnc_console
Browse files Browse the repository at this point in the history
Add decorator for VNC Console
  • Loading branch information
abellotti authored Nov 3, 2017
2 parents efe7610 + 57943ce commit 9957510
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/controllers/api/subcollections/vms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def create_vm_decorators_hash(vm_decorators, vm)
if vm_decorators.include? 'supports_cockpit?'
hash['supports_cockpit?'] = vm.supports_launch_cockpit?
end
if vm_decorators.include?('supports_vnc_console?')
hash['supports_vnc_console?'] = vm.console_supported?('VNC')
end
hash
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/requests/services_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,11 @@ def expect_svc_with_vms
end

it "can query vms as subcollection via decorators with additional decorators" do
get api_service_url(nil, svc1), :params => { :expand => "vms", :attributes => "", :decorators => "vms.supports_console?" }
get api_service_url(nil, svc1), :params => { :expand => "vms", :attributes => "", :decorators => "vms.supports_console?,vms.supports_cockpit?,vms.supports_vnc_console?" }

expect_svc_with_vms
expect_results_to_match_hash("vms", [{"id" => vm1.id.to_s, "supports_console?" => true},
{"id" => vm2.id.to_s, "supports_console?" => true}])
expect_results_to_match_hash("vms", [{"id" => vm1.id.to_s, "supports_console?" => true, "supports_cockpit?" => anything, "supports_vnc_console?" => anything},
{"id" => vm2.id.to_s, "supports_console?" => true, "supports_cockpit?" => anything, "supports_vnc_console?" => anything}])
end

it "cannot query vms via both virtual attribute and subcollection" do
Expand Down

0 comments on commit 9957510

Please sign in to comment.