Skip to content

Commit

Permalink
convert console_supported? to supports?
Browse files Browse the repository at this point in the history
- moving all supports into provider classes
- moving :console from vm_or_template to vm/operations with the rest of them.
- explicitly stating html5_console and console
- native_console had half in supports and half in console_supported. so less of a change

- dropping console_supported?
  • Loading branch information
kbrock committed Mar 8, 2023
1 parent 0667484 commit d65a610
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
6 changes: 0 additions & 6 deletions app/models/vm_or_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1608,10 +1608,6 @@ def add_ems_event(event_type, event_message, event_timestamp)
EmsEvent.add(ems_id, event)
end

def console_supported?(_type)
false
end

# Stop certain charts from showing unless the subclass allows
def non_generic_charts_available?
false
Expand Down Expand Up @@ -1670,8 +1666,6 @@ def tenant_identity
user
end

supports(:console) { N_("Console not supported") unless console_supported?('spice') || console_supported?('vnc') }

def child_resources
children
end
Expand Down
43 changes: 0 additions & 43 deletions spec/models/vm/operations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,49 +53,6 @@
end
end

describe '#supports?(:vmrc_console)' do
it 'returns false if type is not supported' do
allow(@vm).to receive(:console_supported?).with('VMRC').and_return(false)

expect(@vm.supports?(:vmrc_console)).to be_falsey
expect(@vm.unsupported_reason(:vmrc_console)).to include('VMRC Console not supported')
end

it 'supports it if all conditions are met' do
allow(@vm).to receive(:console_supported?).with('VMRC').and_return(true)

expect(@vm.supports?(:vmrc_console)).to be_truthy
end
end

describe '#supports?(:html5_console)' do
it 'supports it if all conditions are met' do
allow(@vm).to receive(:console_supported?).and_return(true)
expect(@vm.supports?(:html5_console)).to be_truthy
end

it 'returns false if type is not supported' do
allow(@vm).to receive(:console_supported?).and_return(false)
expect(@vm.supports?(:html5_console)).to be_falsey
expect(@vm.unsupported_reason(:html5_console)).to include('HTML5 Console is not supported')
end
end

describe '#supports?(:native_console)' do
it 'returns false if type is not supported' do
allow(@vm).to receive(:console_supported?).with('NATIVE').and_return(false)

expect(@vm.supports?(:native_console)).to be_falsey
expect(@vm.unsupported_reason(:native_console)).to include('NATIVE Console not supported')
end

it 'supports it if all conditions are met' do
allow(@vm).to receive(:console_supported?).with('NATIVE').and_return(true)

expect(@vm.supports?(:native_console)).to be_truthy
end
end

describe '#supports?(:launch_vmrc_console)' do
it 'does not support it if validate_remote_console_vmrc_support raises an error' do
allow(@vm).to receive(:validate_remote_console_vmrc_support).and_raise(StandardError)
Expand Down

0 comments on commit d65a610

Please sign in to comment.