test/yao/resources/test_server.rb in yao-0.8.0 vs test/yao/resources/test_server.rb in yao-0.9.0
- old
+ new
@@ -90,54 +90,54 @@
}
server = Yao::Server.new(params)
# friendly_attributes
- assert_equal(server.id, "2ce4c5b3-2866-4972-93ce-77a2ea46a7f9")
- assert_equal(server.addresses, {
+ assert_equal("2ce4c5b3-2866-4972-93ce-77a2ea46a7f9", server.id)
+ assert_equal({
"private" => [
{
"OS-EXT-IPS-MAC:mac_addr" => "aa:bb:cc:dd:ee:ff",
"OS-EXT-IPS:type" => "fixed",
"addr" => "192.168.0.3",
"version" => 4
}
]
- })
- assert_equal(server.metadata, { "My Server Name" => "Apache1" })
- assert_equal(server.name, "new-server-test")
- assert_equal(server.progress, 0)
- assert_equal(server.status, "ACTIVE")
- assert_equal(server.tenant_id, "6f70656e737461636b20342065766572")
- assert_equal(server.user_id, "fake")
- assert_equal(server.key_name, nil)
+ }, server.addresses)
+ assert_equal({ "My Server Name" => "Apache1" }, server.metadata)
+ assert_equal("new-server-test", server.name)
+ assert_equal(0, server.progress)
+ assert_equal("ACTIVE", server.status)
+ assert_equal("6f70656e737461636b20342065766572", server.tenant_id)
+ assert_equal("fake", server.user_id)
+ assert_equal(nil, server.key_name)
# map_attribute_to_attribute
- assert_equal(server.host_id, "2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6")
+ assert_equal("2091634baaccdc4c5a1d57069c833e402921df696b7f970791b12ec6", server.host_id)
# map_attribute_to_resource - flavor
assert_instance_of(Yao::Resources::Flavor, server.flavor)
- assert_equal(server.flavor.disk, 1)
+ assert_equal(1, server.flavor.disk)
# map_attribute_to_resource - image
assert_instance_of(Yao::Resources::Image, server.image)
- assert_equal(server.image.id, "70a599e0-31e7-49b7-b260-868f441e862b")
+ assert_equal("70a599e0-31e7-49b7-b260-868f441e862b", server.image.id)
# map_attribute_to_resource - security_groups
assert_instance_of(Array, server.security_groups)
assert_instance_of(Yao::Resources::SecurityGroup, server.security_groups.first)
- assert_equal(server.security_groups.first.name, "default")
+ assert_equal("default", server.security_groups.first.name)
# map_attribute_to_attribute
- assert_equal(server.availability_zone, "nova")
- assert_equal(server.dcf_disk_config, "AUTO")
- assert_equal(server.ext_srv_attr_host, "compute")
- assert_equal(server.ext_srv_attr_hypervisor_hostname, "fake-mini")
- assert_equal(server.ext_srv_attr_instance_name, "instance-00000001")
- assert_equal(server.ext_sts_power_state, 1)
- assert_equal(server.ext_sts_task_state, nil)
- assert_equal(server.ext_sts_vm_state, "active")
+ assert_equal("nova", server.availability_zone)
+ assert_equal("AUTO", server.dcf_disk_config)
+ assert_equal("compute", server.ext_srv_attr_host)
+ assert_equal("fake-mini", server.ext_srv_attr_hypervisor_hostname)
+ assert_equal("instance-00000001", server.ext_srv_attr_instance_name)
+ assert_equal(1, server.ext_sts_power_state)
+ assert_equal(nil, server.ext_sts_task_state)
+ assert_equal("active", server.ext_sts_vm_state)
end
def test_list
stub = stub_request(:get, "https://example.com:12345/servers/detail")
.to_return(
@@ -155,17 +155,17 @@
assert(Yao::Server.resources_detail_available)
servers = Yao::Server.list
assert_instance_of(Array, servers)
assert_instance_of(Yao::Server, servers.first)
- assert_equal(servers.first.id, 'dummy')
+ assert_equal('dummy', servers.first.id)
assert_requested(stub)
end
def test_list_detail
- assert_equal(Yao::Server.method(:list_detail), Yao::Server.method(:list))
+ assert_equal(Yao::Server.method(:list), Yao::Server.method(:list_detail))
end
def test_tenant
stub = stub_request(:get, "https://example.com:12345/tenants/0123456789abcdef0123456789abcdef")
@@ -181,10 +181,10 @@
headers: {'Content-Type' => 'application/json'}
)
server = Yao::Server.new('tenant_id' => '0123456789abcdef0123456789abcdef')
assert_instance_of(Yao::Tenant, server.tenant)
- assert_equal(server.tenant.id, '0123456789abcdef0123456789abcdef')
+ assert_equal('0123456789abcdef0123456789abcdef', server.tenant.id)
assert_requested(stub)
end
end