Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests for attributes on Models
- Loading branch information
1 parent
659d87f
commit 74b8f50
Showing
33 changed files
with
1,308 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::Blob do | ||
let(:blob_class) do | ||
class Fog::Compute::XenServer::Models::Blob | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::Blob | ||
end | ||
|
||
it 'should return the unique id' do | ||
blob_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 8 attributes' do | ||
blob_class.attributes.must_equal([ :reference, | ||
:description, | ||
:last_updated, | ||
:mime_type, | ||
:name, | ||
:public, | ||
:size, | ||
:uuid ]) | ||
end | ||
|
||
it 'should have 2 aliases' do | ||
blob_class.aliases.must_equal({ :name_description => :description, | ||
:name_label => :name }) | ||
end | ||
end |
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,33 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::Bond do | ||
let(:bond_class) do | ||
class Fog::Compute::XenServer::Models::Bond | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::Bond | ||
end | ||
|
||
it 'should return the unique id' do | ||
bond_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 6 attributes' do | ||
bond_class.attributes.must_equal([ :reference, | ||
:links_up, | ||
:__master, | ||
:mode, | ||
:other_config, | ||
:__primary_slave, | ||
:properties, | ||
:__slaves, :uuid ]) | ||
end | ||
|
||
it 'should have 3 aliases' do | ||
bond_class.aliases.must_equal({ :master => :__master, | ||
:primary_slave => :__primary_slave, | ||
:slaves => :__slaves }) | ||
end | ||
end |
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,29 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::Console do | ||
let(:console_class) do | ||
class Fog::Compute::XenServer::Models::Console | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::Console | ||
end | ||
|
||
it 'should return the unique id' do | ||
console_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 6 attributes' do | ||
console_class.attributes.must_equal([ :reference, | ||
:location, | ||
:other_config, | ||
:protocol, | ||
:uuid, | ||
:__vm ]) | ||
end | ||
|
||
it 'should have 1 alias' do | ||
console_class.aliases.must_equal({ :VM => :__vm }) | ||
end | ||
end |
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,29 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::CrashDump do | ||
let(:crash_dump_class) do | ||
class Fog::Compute::XenServer::Models::CrashDump | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::CrashDump | ||
end | ||
|
||
it 'should return the unique id' do | ||
crash_dump_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 6 attributes' do | ||
crash_dump_class.attributes.must_equal([ :reference, | ||
:other_config, | ||
:uuid, | ||
:__vdi, | ||
:__vm ]) | ||
end | ||
|
||
it 'should have 2 aliases' do | ||
crash_dump_class.aliases.must_equal({ :VDI => :__vdi, | ||
:VM => :__vm }) | ||
end | ||
end |
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,26 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::DrTask do | ||
let(:dr_task_class) do | ||
class Fog::Compute::XenServer::Models::DrTask | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::DrTask | ||
end | ||
|
||
it 'should return the unique id' do | ||
dr_task_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 3 attributes' do | ||
dr_task_class.attributes.must_equal([ :reference, | ||
:__introduced_srs, | ||
:uuid ]) | ||
end | ||
|
||
it 'should have 1 alias' do | ||
dr_task_class.aliases.must_equal({ :introduced_SRs => :__introduced_srs }) | ||
end | ||
end |
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,35 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::GpuGroup do | ||
let(:gpu_group_class) do | ||
class Fog::Compute::XenServer::Models::GpuGroup | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::GpuGroup | ||
end | ||
|
||
it 'should return the unique id' do | ||
gpu_group_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 8 attributes' do | ||
gpu_group_class.attributes.must_equal([ :reference, | ||
:description, | ||
:gpu_types, | ||
:name, | ||
:other_config, | ||
:__pgpus, | ||
:uuid, | ||
:__vgpus ]) | ||
end | ||
|
||
it 'should have 5 aliases' do | ||
gpu_group_class.aliases.must_equal({ :GPU_types => :gpu_types, | ||
:name_description => :description, | ||
:name_label => :name, | ||
:PGPUs => :__pgpus, | ||
:VGPUs => :__vgpus }) | ||
end | ||
end |
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,36 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::GuestMetrics do | ||
let(:guest_metrics_class) do | ||
class Fog::Compute::XenServer::Models::GuestMetrics | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::GuestMetrics | ||
end | ||
|
||
it 'should return the unique id' do | ||
guest_metrics_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 12 attributes' do | ||
guest_metrics_class.attributes.must_equal([ :reference, | ||
:disk, | ||
:last_updated, | ||
:live, | ||
:memory, | ||
:networks, | ||
:os_version, | ||
:other, | ||
:other_config, | ||
:pv_drivers_up_to_date, | ||
:pv_drivers_version, | ||
:uuid ]) | ||
end | ||
|
||
it 'should have 2 aliases' do | ||
guest_metrics_class.aliases.must_equal({ :PV_drivers_up_to_date => :pv_drivers_up_to_date, | ||
:PV_drivers_version => :pv_drivers_version }) | ||
end | ||
end |
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,38 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::HostCpu do | ||
let(:host_cpu_class) do | ||
class Fog::Compute::XenServer::Models::HostCpu | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::HostCpu | ||
end | ||
|
||
it 'should return the unique id' do | ||
host_cpu_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 14 attributes' do | ||
host_cpu_class.attributes.must_equal([ :reference, | ||
:family, | ||
:features, | ||
:flags, | ||
:__host, | ||
:model, | ||
:model_name, | ||
:number, | ||
:other_config, | ||
:speed, | ||
:stepping, | ||
:utilisation, | ||
:uuid, | ||
:vendor ]) | ||
end | ||
|
||
it 'should have 2 aliases' do | ||
host_cpu_class.aliases.must_equal({ :host => :__host, | ||
:modelname => :model_name }) | ||
end | ||
end |
29 changes: 29 additions & 0 deletions
29
test/fog/compute/xen_server/models/host_crash_dump_test.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,29 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::HostCrashDump do | ||
let(:host_crash_dump_class) do | ||
class Fog::Compute::XenServer::Models::HostCrashDump | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::HostCrashDump | ||
end | ||
|
||
it 'should return the unique id' do | ||
host_crash_dump_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 6 attributes' do | ||
host_crash_dump_class.attributes.must_equal([ :reference, | ||
:__host, | ||
:other_config, | ||
:size, | ||
:timestamp, | ||
:uuid ]) | ||
end | ||
|
||
it 'should have 1 alias' do | ||
host_crash_dump_class.aliases.must_equal({ :host => :__host }) | ||
end | ||
end |
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,30 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::HostMetrics do | ||
let(:host_metrics_class) do | ||
class Fog::Compute::XenServer::Models::HostMetrics | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::HostMetrics | ||
end | ||
|
||
it 'should return the unique id' do | ||
host_metrics_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 7 attributes' do | ||
host_metrics_class.attributes.must_equal([ :reference, | ||
:last_updated, | ||
:live, | ||
:memory_free, | ||
:memory_total, | ||
:other_config, | ||
:uuid ]) | ||
end | ||
|
||
it "shouldn't have aliases" do | ||
host_metrics_class.aliases.must_equal({}) | ||
end | ||
end |
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,37 @@ | ||
require 'minitest_helper' | ||
|
||
describe Fog::Compute::XenServer::Models::HostPatch do | ||
let(:host_patch_class) do | ||
class Fog::Compute::XenServer::Models::HostPatch | ||
def self.read_identity | ||
instance_variable_get('@identity') | ||
end | ||
end | ||
Fog::Compute::XenServer::Models::HostPatch | ||
end | ||
|
||
it 'should return the unique id' do | ||
host_patch_class.read_identity.must_equal(:reference) | ||
end | ||
|
||
it 'should have 11 attributes' do | ||
host_patch_class.attributes.must_equal([ :reference, | ||
:applied, | ||
:description, | ||
:__host, | ||
:name, | ||
:other_config, | ||
:__pool_patch, | ||
:size, | ||
:timestamp_applied, | ||
:uuid, | ||
:version ]) | ||
end | ||
|
||
it 'should have 4 aliases' do | ||
host_patch_class.aliases.must_equal({ :host => :__host, | ||
:name_description => :description, | ||
:name_label => :name, | ||
:pool_patch => :__pool_patch }) | ||
end | ||
end |
Oops, something went wrong.