1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/openstack/models/identity/users_tests.rb

33 lines
953 B
Ruby

Shindo.tests("Fog::Identity[:openstack] | users", ['openstack']) do
tenant_id = Fog::Identity[:openstack].list_tenants.body['tenants'].first['id']
@instance = Fog::Identity[:openstack].users.create({
:name => 'foobar',
:email => 'foo@bar.com',
:tenant_id => tenant_id,
:password => 'spoof',
:enabled => true
})
tests('success') do
tests('#find_by_id').succeeds do
user = Fog::Identity[:openstack].users.find_by_id(@instance.id)
user.id == @instance.id
end
tests('#destroy').succeeds do
Fog::Identity[:openstack].users.destroy(@instance.id)
end
end
tests('fails') do
pending if Fog.mocking?
tests('#find_by_id').raises(Fog::Identity::OpenStack::NotFound) do
Fog::Identity[:openstack].users.find_by_id('fake')
end
tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do
Fog::Identity[:openstack].users.destroy('fake')
end
end
end