about summary refs log tree commit homepage
path: root/test/test_mogilefs_integration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_mogilefs_integration.rb')
-rw-r--r--test/test_mogilefs_integration.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb
index 57ea675..947bb34 100644
--- a/test/test_mogilefs_integration.rb
+++ b/test/test_mogilefs_integration.rb
@@ -230,4 +230,29 @@ class TestMogileFSIntegration < TestMogIntegration
     ensure
       r.close if r
   end
+
+  def test_store_content_opts
+    b64digest = [ Digest::MD5.digest("HELLO") ].pack('m').strip
+    assert_nothing_raised do
+      @client.store_content("c", nil, "HELLO", :content_md5 => b64digest)
+    end
+    assert_raises(MogileFS::SizeMismatchError) do
+      @client.store_content("c", nil, "GOODBYE", :content_length => 2)
+    end
+    assert_equal "HELLO", @client.get_file_data("c")
+  end
+
+  def test_store_file_opts
+    b64digest = [ Digest::MD5.digest("HELLO") ].pack('m').strip
+    io = StringIO.new("HELLO")
+    assert_nothing_raised do
+      @client.store_file("c", nil, io, :content_md5 => b64digest)
+    end
+
+    io = StringIO.new("GOODBYE")
+    assert_raises(MogileFS::SizeMismatchError) do
+      @client.store_content("c", nil, io, :content_length => 2)
+    end
+    assert_equal "HELLO", @client.get_file_data("c")
+  end
 end