From da58f47f541cff65e814a614ecff722ba2a35bf8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 7 Dec 2011 01:29:43 +0000 Subject: [PATCH] test for client-side Content-MD5 callback on upload Some applications will rely on this feature --- test/test_mogilefs_integration.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb index 947bb34..88657a9 100644 --- a/test/test_mogilefs_integration.rb +++ b/test/test_mogilefs_integration.rb @@ -255,4 +255,18 @@ class TestMogileFSIntegration < TestMogIntegration end assert_equal "HELLO", @client.get_file_data("c") end + + def test_store_file_content_md5_lambda + checked = false + expect_md5 = lambda do + checked = true + [ Digest::MD5.digest("HELLO") ].pack('m').strip + end + io = StringIO.new("HELLO") + assert_nothing_raised do + @client.store_file("c", nil, io, :content_md5 => expect_md5) + end + + assert_equal true, checked, "expect_md5 lambda called" + end end -- 2.11.4.GIT