2012-02-22 09:40:32 -05:00
|
|
|
Shindo.tests('Fog::Identity[:openstack] | tenant requests', ['openstack']) do
|
|
|
|
|
|
|
|
@tenant_format = {
|
|
|
|
'id' => String,
|
|
|
|
'name' => String,
|
2012-02-26 03:09:22 -05:00
|
|
|
'enabled' => Fog::Nullable::Boolean,
|
|
|
|
'description' => Fog::Nullable::String,
|
|
|
|
'extra' => Fog::Nullable::Hash
|
2012-02-22 09:40:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@role_format = {
|
|
|
|
'id' => String,
|
|
|
|
'name' => String
|
|
|
|
}
|
|
|
|
|
|
|
|
tests('success') do
|
2012-02-26 03:09:22 -05:00
|
|
|
tests('#list_tenants').formats({'tenants' => [@tenant_format], 'tenants_links' => []}) do
|
2012-02-22 09:40:32 -05:00
|
|
|
Fog::Identity[:openstack].list_tenants.body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#list_roles_for_user_on_tenant(0,1)').
|
|
|
|
formats({'roles' => [@role_format]}) do
|
|
|
|
|
2012-02-26 03:09:22 -05:00
|
|
|
openstack = Fog::Identity[:openstack]
|
|
|
|
openstack.list_roles_for_user_on_tenant(
|
|
|
|
openstack.tenants.first, openstack.users.first).body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#create_tenant').formats({'tenant' => @tenant_format}) do
|
|
|
|
@instance = Fog::Identity[:openstack].create_tenant('name' => 'test').body
|
2012-02-22 09:40:32 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('#get_tenant').formats({'tenant' => @tenant_format}) do
|
2012-02-26 03:09:22 -05:00
|
|
|
Fog::Identity[:openstack].get_tenant(@instance['tenant']['id']).body
|
2012-02-22 09:40:32 -05:00
|
|
|
end
|
2012-02-26 03:09:22 -05:00
|
|
|
|
|
|
|
tests('#update_tenant check format').formats({'tenant' => @tenant_format}) do
|
|
|
|
@instance = Fog::Identity[:openstack].update_tenant(
|
|
|
|
@instance['tenant']['id'], 'name' => 'test2').body
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#update_tenant update name').succeeds do
|
|
|
|
@instance = Fog::Identity[:openstack].update_tenant(
|
|
|
|
@instance['tenant']['id'], 'name' => 'test3').body
|
|
|
|
@instance['tenant']['name'] == 'test3'
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#delete_tenant').succeeds do
|
|
|
|
Fog::Identity[:openstack].delete_tenant(@instance['tenant']['id'])
|
|
|
|
end
|
|
|
|
|
2012-02-22 09:40:32 -05:00
|
|
|
end
|
|
|
|
end
|