13996: Migrate tests to new config
[arvados.git] / services / api / test / integration / jobs_api_test.rb
index 4499a92cdf7236a66c6d6a727bf7ccf3ed705f77..f5fb920b46d82e4e48bd06c5db1b145ebd5279b3 100644 (file)
@@ -49,4 +49,43 @@ class JobsApiTest < ActionDispatch::IntegrationTest
       last_qsequence = qsequence
     end
   end
+
+  test 'get_delete components_get again for job with components' do
+    authorize_with :active
+    get "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}",
+      headers: auth(:active)
+    assert_response 200
+    assert_not_nil json_response["components"]
+    assert_equal ["component1", "component2"], json_response["components"].keys
+
+    # delete second component
+    put "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}", params: {
+      job: {
+        components: {"component1" => "zzzzz-8i9sb-jobuuid00000001"}
+      },
+      limit: 1000
+    }, headers: auth(:active)
+    assert_response 200
+
+    get "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}",
+      headers: auth(:active)
+    assert_response 200
+    assert_not_nil json_response["components"]
+    assert_equal ["component1"], json_response["components"].keys
+
+    # delete all components
+    put "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}", params: {
+      job: {
+        components: nil
+      },
+      limit: 1000
+    }, headers: auth(:active)
+    assert_response 200
+
+    get "/arvados/v1/jobs/#{jobs(:running_job_with_components).uuid}",
+      headers: auth(:active)
+    assert_response 200
+    assert_not_nil json_response["components"]
+    assert_equal [], json_response["components"].keys
+  end
 end