[ARVADOS] updated: fd0ca9211847806adb2e97c0ae78e9312ef89ca1

git at public.curoverse.com git at public.curoverse.com
Thu Oct 30 13:45:37 EDT 2014


Summary of changes:
 apps/workbench/app/models/pipeline_instance.rb     |  6 +++-
 apps/workbench/test/unit/pipeline_instance_test.rb | 42 +++++++++++++++-------
 2 files changed, 35 insertions(+), 13 deletions(-)

       via  fd0ca9211847806adb2e97c0ae78e9312ef89ca1 (commit)
      from  e2fe6c0e5c1c62a37e03519590c04a5186a2cc9b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit fd0ca9211847806adb2e97c0ae78e9312ef89ca1
Author: Brett Smith <brett at curoverse.com>
Date:   Thu Oct 30 13:45:10 2014 -0400

    4307: Workbench: only pipeline components are not editable after start.
    
    This fixes a regression from d7fdbbab.  Closes #4307.

diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index 83328b9..f575e20 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -52,7 +52,11 @@ class PipelineInstance < ArvadosBase
   end
 
   def attribute_editable?(name, ever=nil)
-    (ever or %w(New Ready).include?(state)) and super
+    if name.to_s == "components"
+      (ever or %w(New Ready).include?(state)) and super
+    else
+      super
+    end
   end
 
   def attributes_for_display
diff --git a/apps/workbench/test/unit/pipeline_instance_test.rb b/apps/workbench/test/unit/pipeline_instance_test.rb
index 95ad8fa..4cad6e6 100644
--- a/apps/workbench/test/unit/pipeline_instance_test.rb
+++ b/apps/workbench/test/unit/pipeline_instance_test.rb
@@ -1,31 +1,49 @@
 require 'test_helper'
 
 class PipelineInstanceTest < ActiveSupport::TestCase
+  def attribute_editable_for?(token_name, pi_name, attr_name, ever=nil)
+    use_token token_name
+    find_fixture(PipelineInstance, pi_name).attribute_editable?(attr_name, ever)
+  end
+
   test "admin can edit name" do
-    use_token :admin
-    assert(find_fixture(PipelineInstance, "new_pipeline_in_subproject")
-             .attribute_editable?("name"),
+    assert(attribute_editable_for?(:admin, "new_pipeline_in_subproject",
+                                   "name"),
            "admin not allowed to edit pipeline instance name")
   end
 
   test "project owner can edit name" do
-    use_token :active
-    assert(find_fixture(PipelineInstance, "new_pipeline_in_subproject")
-             .attribute_editable?("name"),
+    assert(attribute_editable_for?(:active, "new_pipeline_in_subproject",
+                                   "name"),
            "project owner not allowed to edit pipeline instance name")
   end
 
   test "project admin can edit name" do
-    use_token :subproject_admin
-    assert(find_fixture(PipelineInstance, "new_pipeline_in_subproject")
-             .attribute_editable?("name"),
+    assert(attribute_editable_for?(:subproject_admin,
+                                   "new_pipeline_in_subproject", "name"),
            "project admin not allowed to edit pipeline instance name")
   end
 
   test "project viewer cannot edit name" do
-    use_token :project_viewer
-    refute(find_fixture(PipelineInstance, "new_pipeline_in_subproject")
-             .attribute_editable?("name"),
+    refute(attribute_editable_for?(:project_viewer,
+                                   "new_pipeline_in_subproject", "name"),
            "project viewer allowed to edit pipeline instance name")
   end
+
+  test "name editable on completed pipeline" do
+    assert(attribute_editable_for?(:active, "has_component_with_completed_jobs",
+                                   "name"),
+           "name not editable on complete pipeline")
+  end
+
+  test "components editable on new pipeline" do
+    assert(attribute_editable_for?(:active, "new_pipeline", "components"),
+           "components not editable on new pipeline")
+  end
+
+  test "components not editable on completed pipeline" do
+    refute(attribute_editable_for?(:active, "has_component_with_completed_jobs",
+                                   "components"),
+           "components not editable on new pipeline")
+  end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list