diff --git a/src/cloud/occi/test/fixtures/user.xml b/src/cloud/occi/test/fixtures/user.xml
new file mode 100644
index 0000000000..e48812af7b
--- /dev/null
+++ b/src/cloud/occi/test/fixtures/user.xml
@@ -0,0 +1 @@
+0oneadmin00000000
\ No newline at end of file
diff --git a/src/cloud/occi/test/fixtures/user_collection.xml b/src/cloud/occi/test/fixtures/user_collection.xml
new file mode 100644
index 0000000000..67f7f0baa6
--- /dev/null
+++ b/src/cloud/occi/test/fixtures/user_collection.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/cloud/occi/test/spec/spec_helper.rb b/src/cloud/occi/test/spec/spec_helper.rb
new file mode 100644
index 0000000000..b942548ed1
--- /dev/null
+++ b/src/cloud/occi/test/spec/spec_helper.rb
@@ -0,0 +1,39 @@
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+FIXTURES_PATH = File.join(File.dirname(__FILE__),'../fixtures')
+$: << File.join(File.dirname(__FILE__), '..', '..', 'lib')
+
+# Load the testing libraries
+require 'rubygems'
+require 'rspec'
+require 'rack/test'
+
+# Load the Sinatra app
+require 'occi-server'
+
+# Make Rack::Test available to all spec contexts
+RSpec.configure do |conf|
+ conf.include Rack::Test::Methods
+end
+
+# Set the Sinatra environment
+set :environment, :test
+
+# Add an app method for RSpec
+def app
+ Sinatra::Application
+end
diff --git a/src/cloud/occi/test/spec/user_spec.rb b/src/cloud/occi/test/spec/user_spec.rb
new file mode 100644
index 0000000000..1a66f454ef
--- /dev/null
+++ b/src/cloud/occi/test/spec/user_spec.rb
@@ -0,0 +1,73 @@
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe 'OCCI User tests' do
+ before(:all) do
+ @username_1 = "my_first_occi_user"
+ @userpass_1 = "my_first_occi_pass"
+ `oneuser create #{@username_1} #{@userpass_1}`
+ end
+
+ it "should list the user collection" do
+ basic_authorize('oneadmin','4478db59d30855454ece114e8ccfa5563d21c9bd')
+ get '/user'
+
+ last_response.status.should eql(200)
+
+ xml_body = last_response.body
+
+ user_collection = File.read(FIXTURES_PATH + '/user_collection.xml')
+
+ xml_body.strip.should eql(user_collection.strip)
+ end
+
+
+ it "should check the error if the user collection is retrieved by a non oneadmin user" do
+ basic_authorize('my_first_occi_user','c08c5a6c535b6060b7b2af34e0d2f0ffb7e63b28')
+ get '/user'
+
+ last_response.status.should eql(403)
+ end
+
+ it "should show the user information, no quotas and no usage" do
+ basic_authorize('oneadmin','4478db59d30855454ece114e8ccfa5563d21c9bd')
+ get '/user/0'
+
+ last_response.status.should eql(200)
+
+ xml_body = last_response.body
+
+ user = File.read(FIXTURES_PATH + '/user.xml')
+
+ xml_body.strip.should eql(user.strip)
+ end
+
+ it "should get a 404 error when trying to get a non existing user" do
+ basic_authorize('oneadmin','4478db59d30855454ece114e8ccfa5563d21c9bd')
+ get '/user/99'
+
+ last_response.status.should eql(404)
+ end
+
+ it "should get a 403 error when trying to get a different user" do
+ basic_authorize('my_first_occi_user','c08c5a6c535b6060b7b2af34e0d2f0ffb7e63b28')
+ get '/user/0'
+
+ last_response.status.should eql(403)
+ end
+end
diff --git a/src/cloud/occi/test/test.sh b/src/cloud/occi/test/test.sh
new file mode 100755
index 0000000000..e61a10bb6f
--- /dev/null
+++ b/src/cloud/occi/test/test.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
+# #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may #
+# not use this file except in compliance with the License. You may obtain #
+# a copy of the License at #
+# #
+# http://www.apache.org/licenses/LICENSE-2.0 #
+# #
+# Unless required by applicable law or agreed to in writing, software #
+# distributed under the License is distributed on an "AS IS" BASIS, #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
+# See the License for the specific language governing permissions and #
+# limitations under the License. #
+#--------------------------------------------------------------------------- #
+
+if [ -z $ONE_LOCATION ]; then
+ echo "ONE_LOCATION not defined."
+ exit -1
+fi
+
+VAR_LOCATION="$ONE_LOCATION/var"
+rm -rf $VAR_LOCATION/*
+
+if [ "$(ls -A $VAR_LOCATION)" ]; then
+ echo "$VAR_LOCATION is not empty."
+ exit -1
+fi
+
+for j in `ls ./spec/*_spec.rb` ; do
+ PID=$$
+
+ oned -f &
+ sleep 2s;
+
+ rspec $j -f s
+ CODE=$?
+
+ pkill -P $PID oned
+ sleep 2s;
+ pkill -9 -P $PID oned
+
+ if [ $CODE != 0 ] ; then
+ exit 1
+ fi
+
+ find $VAR_LOCATION -mindepth 1 -delete
+done