-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding connected physical servers to physical switches page
- Loading branch information
1 parent
f6c97ab
commit 4c8cfde
Showing
4 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
spec/helpers/physical_switch_helper/textual_summary_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
describe PhysicalSwitchHelper::TextualSummary do | ||
include ApplicationHelper | ||
|
||
let(:ems) do | ||
FactoryGirl.create(:physical_infra, | ||
:name => 'LXCA', | ||
:hostname => 'my.physicalinfra.com', | ||
:port => '443', | ||
:ipaddress => '1.2.3.4') | ||
end | ||
|
||
let(:asset_detail) do | ||
FactoryGirl.create(:asset_detail, | ||
:product_name => 'Switch Product Name', | ||
:serial_number => 'Switch serial number', | ||
:part_number => 'Switch part number', | ||
:field_replaceable_unit => 'FRU', | ||
:description => 'Switch description', | ||
:manufacturer => 'Switch manufacturer') | ||
end | ||
|
||
let(:network) do | ||
FactoryGirl.build(:network, :ipaddress => '192.168.1.1') | ||
end | ||
|
||
let(:hardware) do | ||
FactoryGirl.build(:hardware, :networks => [network]) | ||
end | ||
|
||
let(:switch_physical_network_port) do | ||
FactoryGirl.create(:physical_network_port, | ||
:uid_ems => '1', | ||
:connected_port_uid => '2') | ||
end | ||
|
||
let(:physical_switch) do | ||
FactoryGirl.create(:physical_switch, | ||
:name => 'Switch name', | ||
:uid_ems => 'NVH20GH0T4HN268902G6Y2N-G28Y8YWG', | ||
:switch_uuid => 'NVH20GH0T4HN268902G6Y2N-G28Y8YWG', | ||
:power_state => 'On', | ||
:health_state => 'Valid', | ||
:ems_id => ems.id, | ||
:asset_detail => asset_detail, | ||
:hardware => hardware, | ||
:physical_network_ports => [switch_physical_network_port]) | ||
end | ||
|
||
let(:server_physical_network_port) do | ||
physical_server = FactoryGirl.build(:physical_server) | ||
|
||
server_computer_system = FactoryGirl.build(:computer_system, :managed_entity => physical_server) | ||
|
||
server_guest_device = FactoryGirl.build(:guest_device, :computer_system => server_computer_system) | ||
|
||
server_physical_network_port = FactoryGirl.create(:physical_network_port, | ||
:uid_ems => '2', | ||
:connected_port_uid => '1', | ||
:guest_device => server_guest_device, | ||
) | ||
end | ||
|
||
before do | ||
server_physical_network_port | ||
@record = physical_switch | ||
end | ||
|
||
# | ||
# Textual Groups | ||
# Properties, Management Network, Relationships, Power Management, Connected Components | ||
# | ||
describe '.textual_group_properties' do | ||
subject { textual_group_properties } | ||
|
||
it 'has the right title' do | ||
expect(subject.title).to eq('Properties') | ||
end | ||
|
||
it 'shows main properties' do | ||
expect(subject.items).to include( | ||
:name, | ||
:product_name, | ||
:manufacturer, | ||
:serial_number, | ||
:part_number, | ||
:ports, | ||
:health_state, | ||
:uid_ems, | ||
:description | ||
) | ||
end | ||
end | ||
|
||
describe '.textual_group_management_networks' do | ||
subject { textual_group_management_networks } | ||
|
||
it 'has the right title' do | ||
expect(subject.title).to eq('Management Networks') | ||
end | ||
|
||
it 'shows 1 management ipaddress' do | ||
expect(subject.rows).to be_kind_of(Array) | ||
expect(subject.rows[0].size).to eq(3) | ||
expect(subject.rows[0][0]).to eq('192.168.1.1') | ||
end | ||
end | ||
|
||
describe '.textual_group_relationships' do | ||
subject { textual_group_relationships } | ||
|
||
it 'has the right title' do | ||
expect(subject.title).to eq('Relationships') | ||
end | ||
|
||
it 'shows main relationships' do | ||
expect(subject.items).to include(:ext_management_system) | ||
end | ||
end | ||
|
||
describe '.textual_group_power_management' do | ||
subject { textual_group_power_management } | ||
|
||
it 'has the right title' do | ||
expect(subject.title).to eq('Power Management') | ||
end | ||
|
||
it 'shows power state' do | ||
expect(subject.items).to include(:power_state) | ||
end | ||
end | ||
|
||
describe '.textual_group_connected_components' do | ||
subject { textual_group_connected_components } | ||
|
||
it 'has the right title' do | ||
expect(subject.title).to eq('Connected Components') | ||
end | ||
|
||
it 'shows connected components' do | ||
expect(subject.items).to include(:connected_physical_servers) | ||
end | ||
|
||
it 'shows connected components' do | ||
expect(subject.items).to include(:connected_physical_servers) | ||
end | ||
end | ||
end |