closes #5186
[arvados.git] / services / api / test / unit / collection_test.rb
index 89c9de3a54aad98210395d3e0e439b0c885e0405..08f46fddccced0974db6cf12f51f04827f862734 100644 (file)
@@ -118,4 +118,23 @@ class CollectionTest < ActiveSupport::TestCase
       end
     end
   end
+
+  [0, 2, 4, nil].each do |ask|
+    test "replication_desired reports #{ask or 2} if redundancy is #{ask}" do
+      act_as_user users(:active) do
+        c = collections(:collection_owned_by_active)
+        c.update_attributes redundancy: ask
+        assert_equal (ask or 2), c.replication_desired
+      end
+    end
+  end
+
+  test "create collection with properties" do
+    act_as_system_user do
+      c = Collection.create(manifest_text: ". acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:foo\n",
+                            properties: {'property_1' => 'value_1'})
+      assert c.valid?
+      assert_equal 'value_1', c.properties['property_1']
+    end
+  end
 end