forked from gwdg/rOCCI
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added spec for creating a compute resource
- Loading branch information
Florian Feldhaus
committed
Mar 30, 2012
1 parent
40712fd
commit b74cecd
Showing
1 changed file
with
23 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |