1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/requests/identity/create_tenant.rb
Philip Mark M. Deazeta 609995ccbe [openstack] Fixed mocks for failing shindo tests
reverted back to double quoted string

Conflicts:
	lib/fog/openstack/identity.rb
	lib/fog/openstack/requests/compute/get_volume_details.rb
	lib/fog/openstack/requests/compute/list_security_groups.rb
	lib/fog/openstack/requests/identity/list_tenants.rb
	lib/fog/openstack/requests/image/create_image.rb
	lib/fog/openstack/requests/image/list_public_images.rb
	lib/fog/openstack/requests/image/list_public_images_detailed.rb
	lib/fog/openstack/requests/image/update_image.rb
	tests/openstack/requests/compute/volume_tests.rb
2012-09-28 15:07:38 +08:00

34 lines
963 B
Ruby

module Fog
module Identity
class OpenStack
class Real
def create_tenant(attributes)
request(
:expects => [200],
:method => 'POST',
:path => "tenants",
:body => {
'tenant' => attributes
}.to_json
)
end # def create_tenant
end # class Real
class Mock
def create_tenant(attributes)
response = Excon::Response.new
response.status = [200, 204][rand(1)]
response.body = {
'tenant' => {
'id' => "df9a815161eba9b76cc748fd5c5af73e",
'description' => attributes['description'] || 'normal tenant',
'enabled' => true,
'name' => attributes['name'] || 'default'
}
}
response
end # def create_tenant
end # class Mock
end # class OpenStack
end # module Identity
end # module Fog