2012-02-26 03:09:22 -05:00
|
|
|
module Fog
|
|
|
|
module Identity
|
|
|
|
class OpenStack
|
|
|
|
class Real
|
|
|
|
def create_tenant(attributes)
|
|
|
|
request(
|
|
|
|
:expects => [200],
|
|
|
|
:method => 'POST',
|
|
|
|
:path => "tenants",
|
2012-12-07 07:16:08 -05:00
|
|
|
:body => Fog::JSON.encode({ 'tenant' => attributes })
|
2012-02-26 03:09:22 -05:00
|
|
|
)
|
|
|
|
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' => {
|
2012-09-03 02:40:34 -04:00
|
|
|
'id' => "df9a815161eba9b76cc748fd5c5af73e",
|
|
|
|
'description' => attributes['description'] || 'normal tenant',
|
2012-02-26 03:09:22 -05:00
|
|
|
'enabled' => true,
|
2012-09-03 02:40:34 -04:00
|
|
|
'name' => attributes['name'] || 'default'
|
2012-02-26 03:09:22 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
response
|
|
|
|
end # def create_tenant
|
|
|
|
end # class Mock
|
|
|
|
end # class OpenStack
|
|
|
|
end # module Identity
|
|
|
|
end # module Fog
|