Sha256: 33a9797f9a365965dfb3d22cf7283d2339b2470c84e90052763093343dbcbe44
Contents?: true
Size: 1.93 KB
Versions: 2
Compression:
Stored size: 1.93 KB
Contents
require 'rubygems' require 'require_relative' if RUBY_VERSION < '1.9' require_relative File.join('..', 'common.rb') describe Deltacloud::Collections::Instances do before do def app; Deltacloud::API; end authorize 'mockuser', 'mockpassword' @collection = Deltacloud::Collections.collection(:instances) end it 'has index operation' do @collection.operation(:index).must_equal Sinatra::Rabbit::InstancesCollection::IndexOperation end it 'provides URL to specify new instance' do header 'Accept', 'text/html' get root_url + '/instances/new?image_id=img1' status.must_equal 200 end it 'returns list of instances in various formats with index operation' do formats.each do |format| header 'Accept', format get root_url + '/instances' status.must_equal 200 end end it 'returns details about instance in various formats with show operation' do formats.each do |format| header 'Accept', format get root_url + '/instances/inst1' status.must_equal 200 end end it 'allow to create and execute actions on created instance' do post root_url + '/instances', { :image_id => 'img1', :name => 'test', } status.must_equal 201 instance_id = xml.root[:id] instance_id.wont_be_nil delete root_url + '/instances/' + instance_id status.must_equal 405 # You can't remove RUNNING instance (xml/'error/message').first.text.strip.must_equal 'Requested method not allowed' post root_url + '/instances/' + instance_id + '/reboot' status.must_equal 202 post root_url + '/instances/' + instance_id + '/stop' status.must_equal 202 post root_url + '/instances/' + instance_id + '/start' status.must_equal 202 post root_url + '/instances/' + instance_id + '/stop' status.must_equal 202 (xml/'instance/state').first.text.strip.must_equal 'STOPPED' delete root_url + '/instances/' + instance_id status.must_equal 204 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deltacloud-core-1.0.3 | tests/deltacloud/collections/instances_collection_test.rb |
deltacloud-core-1.0.2 | tests/deltacloud/collections/instances_collection_test.rb |