Delete the actual binary objects with the data objects
This commit is contained in:
parent
2c9979f544
commit
5384e3d355
@ -105,6 +105,12 @@ module RemoteStorage
|
||||
end
|
||||
|
||||
def delete_data(user, directory, key)
|
||||
object = data_bucket.get("#{user}:#{directory}:#{key}")
|
||||
|
||||
if binary_link = object.links.select {|l| l.tag == "binary"}.first
|
||||
client[binary_link.bucket].delete(binary_link.key)
|
||||
end
|
||||
|
||||
riak_response = data_bucket.delete("#{user}:#{directory}:#{key}")
|
||||
|
||||
timestamp = (Time.now.to_f * 1000).to_i
|
||||
|
@ -248,8 +248,11 @@ describe "App with Riak backend" do
|
||||
end
|
||||
|
||||
describe "DELETE" do
|
||||
it "removes the key" do
|
||||
before do
|
||||
header "Authorization", "Bearer 123"
|
||||
end
|
||||
|
||||
it "removes the key" do
|
||||
delete "/jimmy/documents/foo"
|
||||
|
||||
last_response.status.must_equal 204
|
||||
@ -257,6 +260,33 @@ describe "App with Riak backend" do
|
||||
data_bucket.get("jimmy:documents:foo")
|
||||
}.must_raise Riak::HTTPFailedRequest
|
||||
end
|
||||
|
||||
context "binary data" do
|
||||
before do
|
||||
header "Content-Type", "image/jpeg; charset=binary"
|
||||
filename = File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", "rockrule.jpeg")
|
||||
@image = File.open(filename, "r").read
|
||||
put "/jimmy/documents/jaypeg", @image
|
||||
end
|
||||
|
||||
it "removes the main object" do
|
||||
delete "/jimmy/documents/jaypeg"
|
||||
|
||||
last_response.status.must_equal 204
|
||||
lambda {
|
||||
data_bucket.get("jimmy:documents:jaypeg")
|
||||
}.must_raise Riak::HTTPFailedRequest
|
||||
end
|
||||
|
||||
it "removes the binary object" do
|
||||
delete "/jimmy/documents/jaypeg"
|
||||
|
||||
last_response.status.must_equal 204
|
||||
lambda {
|
||||
binary_bucket.get("jimmy:documents:jaypeg")
|
||||
}.must_raise Riak::HTTPFailedRequest
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user