mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Store the user_id in the server mock data
OpenStack returns the user_id, not the username, in the list_servers_detail response. This commit looks up or creates a user to retrieve its id so it matches real OpenStack behavior.
This commit is contained in:
parent
6628281f5a
commit
4a0f5f4fea
1 changed files with 16 additions and 0 deletions
|
@ -56,6 +56,22 @@ module Fog
|
|||
response.status = 202
|
||||
|
||||
server_id = Fog::Mock.random_numbers(6).to_s
|
||||
identity = Fog::Identity[:openstack]
|
||||
user = identity.users.find { |u|
|
||||
u.name == @openstack_username
|
||||
}
|
||||
|
||||
user_id = if user then
|
||||
user.id
|
||||
else
|
||||
identity.user.create(:name => @openstack_username,
|
||||
:password => 'password',
|
||||
:email =>
|
||||
"#{@openstack_username}@example",
|
||||
:tenant_id => @openstack_tenant,
|
||||
:enabled => true).id
|
||||
end
|
||||
|
||||
|
||||
mock_data = {
|
||||
'addresses' => {},
|
||||
|
|
Loading…
Reference in a new issue