Merge branch '15673-faraday-pin'
[arvados.git] / sdk / cli / test / test_arv-collection-create.rb
index 18bef403b761f52701fdc86b2919dac44de59e13..39c50bcc837653d975e308a3ae9b567aa759a12b 100644 (file)
@@ -1,14 +1,18 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
 require 'minitest/autorun'
 require 'digest/md5'
+require 'active_support'
 require 'active_support/core_ext'
+require 'tempfile'
 
 class TestCollectionCreate < Minitest::Test
   def setup
   end
 
   def test_small_collection
-    skip "Waiting unitl #4534 is implemented"
-
     uuid = Digest::MD5.hexdigest(foo_manifest) + '+' + foo_manifest.size.to_s
     out, err = capture_subprocess_io do
       assert_arv('--format', 'uuid', 'collection', 'create', '--collection', {
@@ -16,9 +20,24 @@ class TestCollectionCreate < Minitest::Test
                    manifest_text: foo_manifest
                  }.to_json)
     end
-    assert /^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out)
+    assert(/^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out))
     assert_equal '', err
-    $stderr.puts err
+  end
+
+  def test_read_resource_object_from_file
+    tempfile = Tempfile.new('collection')
+    begin
+      tempfile.write({manifest_text: foo_manifest}.to_json)
+      tempfile.close
+      out, err = capture_subprocess_io do
+        assert_arv('--format', 'uuid',
+                   'collection', 'create', '--collection', tempfile.path)
+      end
+      assert(/^([0-9a-z]{5}-4zz18-[0-9a-z]{15})?$/.match(out))
+      assert_equal '', err
+    ensure
+      tempfile.unlink
+    end
   end
 
   protected