Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Added a test to check if an object can be updated
Browse files Browse the repository at this point in the history
with ace that already exists.

Change-Id: I3ab72dd3ea86105a96c1ee1f80e2e7cbfc264a4f
  • Loading branch information
joeldsa committed Mar 7, 2012
1 parent ff16a04 commit a2d81d8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion spec/functional/object_controller_spec.rb
Expand Up @@ -861,7 +861,26 @@ def app
updated_object[:id].should eql(@object[:id])
updated_object[:permission_sets].should eql(@object[:permission_sets])
updated_object[:additional_info].should eql(@object[:additional_info])
end
end

it "should return an object with an updated ace even if the user already has permissions to the object" do
basic_authorize "admin", "password"

put "/objects/#{@object[:id]}/acl?id=u-#{@user4}&p=read_appspace", {}, { "CONTENT_TYPE" => "application/json" }
@logger.debug("put /objects/#{@object[:id]}/acl?id=u-#{@user4}&p=read_appspace last response #{last_response.inspect}")
last_response.status.should eql(200)
last_response.original_headers["Content-Type"].should eql("application/json;charset=utf-8, schema=urn:acm:schemas:1.0")
last_response.original_headers["Content-Length"].should_not eql("0")

updated_object = Yajl::Parser.parse(last_response.body, :symbolize_keys => true)
last_response.original_headers["Location"].should eql("http://example.org/objects/#{updated_object[:id]}")

(updated_object[:acl][:read_appspace].include? ("u-#{@user4}")).should be_true
updated_object[:id].should eql(@object[:id])
updated_object[:permission_sets].should eql(@object[:permission_sets])
updated_object[:additional_info].should eql(@object[:additional_info])
end


it "should return an object with an updated ace for a set of permissions that exists on the object" do
basic_authorize "admin", "password"
Expand Down

0 comments on commit a2d81d8

Please sign in to comment.