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.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_mogilefs_integration.rb b/test/test_mogilefs_integration.rb
index ba9ffbb..4882cce 100644
--- a/test/test_mogilefs_integration.rb
+++ b/test/test_mogilefs_integration.rb
@@ -290,4 +290,25 @@ class TestMogileFSIntegration < TestMogIntegration
 
     assert_equal "HIHI", @client.get_file_data("unlinked")
   end
+
+  def test_updateclass
+    admin = MogileFS::Admin.new(:hosts => @trackers)
+    admin.create_class(@domain, "one", 1)
+    admin.create_class(@domain, "two", 2)
+    4.times { admin.clear_cache }
+
+    assert_equal 4, @client.store_content("uc", "default", "DATA")
+    assert_equal true, @client.updateclass("uc", "one")
+    assert_equal true, @client.updateclass("uc", "two")
+    assert_raises(MogileFS::Backend::ClassNotFoundError) do
+      @client.updateclass("uc", "wtf")
+    end
+    assert_raises(MogileFS::Backend::InvalidKeyError) do
+      @client.updateclass("nonexistent", "one")
+    end
+
+    @client.delete "uc"
+    admin.delete_class @domain, "one"
+    admin.delete_class @domain, "two"
+  end
 end