-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
image_v1_spec.rb
41 lines (36 loc) · 1.16 KB
/
image_v1_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'spec_helper'
require_relative './shared_context'
describe Fog::OpenStack::Image do
before :all do
openstack_vcr = OpenStackVCR.new(
:vcr_directory => 'spec/fixtures/openstack/image_v1',
:service_class => Fog::OpenStack::Image::V1
)
@service = openstack_vcr.service
end
it 'lists available images' do
VCR.use_cassette('list_images') do
@images = @service.images.all
end
end
describe 'find_by_id' do
it 'finds image' do
existing_image_id = 'ea20c966-d2fb-4287-a2eb-7bece9af4263'
VCR.use_cassette('images_v1_find_by_id') do
@service.images.find_by_id(existing_image_id).id.must_equal existing_image_id
end
end
it 'returns nil when image is not found' do
VCR.use_cassette('images_v1_find_by_id') do
assert_nil @service.images.find_by_id('non-existing-id')
end
end
it 'returns custom properties' do
existing_image_id = 'ea20c966-d2fb-4287-a2eb-7bece9af4263'
expected_value = 'bar'
VCR.use_cassette('images_v1_find_by_id') do
@service.images.find_by_id(existing_image_id).properties['foo'].must_equal expected_value
end
end
end
end