Skip to content

Commit

Permalink
added spec for creating a compute resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Feldhaus committed Mar 30, 2012
1 parent 40712fd commit b74cecd
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions spec/occi/occi_server_spec.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
require 'occi/occi-server'
require 'rspec'
require 'rack/test'
require 'logger'

VERSION_NUMBER=0.5

module OCCI
describe OCCIServer do
include Rack::Test::Methods
def app
OCCIServer
end
describe OCCIServer do
include Rack::Test::Methods

it "serves registered categories through discovery interface" do
get '/-/'
last_response.should be_ok
last_response.body.should include('Category')
end
def app
OCCIServer.new({:log_level => Logger::UNKNOWN})
end
end

it "serves registered categories through discovery interface" do
get '/-/'
last_response.should be_ok
last_response.body.should include('Category')
end

it "creates new compute resource" do
headers = {:accept => "text/uri-list"}
body = %Q{Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind";}
body += %Q{\nX-OCCI-Attribute: occi.compute.cores=2}
body += %Q{\nX-OCCI-Attribute: occi.compute.hostname="mycompute.example.com"}
post '/compute/', body, headers
last_response.should be_ok
last_response.body.should include('Location')
end

end

0 comments on commit b74cecd

Please sign in to comment.