Story 2352: Adding state and components_summary is completed.
authorradhika chippada <radhika@curoverse.com>
Wed, 23 Apr 2014 19:01:41 +0000 (15:01 -0400)
committerradhika chippada <radhika@curoverse.com>
Wed, 23 Apr 2014 19:01:41 +0000 (15:01 -0400)
services/api/app/models/pipeline_instance.rb
services/api/test/unit/pipeline_instance_test.rb

index fbe36906373c5bbfd93b9e65cf001ab33ca5f8de..d314885cd3f32b8e9c96d4b285d8efa7164ef5ff 100644 (file)
@@ -178,7 +178,7 @@ class PipelineInstance < ArvadosModel
       else
         return false
       end
-    elsif components_changed? 
+    elsif components_changed?
       if !self.state || self.state == New || !self.active
         if self.components_look_ready?
           self.state = Ready
index 20c833fa102c34a9a9b67c67a9a562ca38c69808..dfda3cc9c8c218b856430fe8899d9c0426d66bdd 100644 (file)
@@ -10,6 +10,8 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     assert !pi.state, 'expected state to be nil because the fixture had no state specified'
 
     # save the pipeline and expect state to be New
+    Thread.current[:user] = users(:admin)
+
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New for new pipeline'
@@ -18,6 +20,8 @@ class PipelineInstanceTest < ActiveSupport::TestCase
   end
 
   test "update attributes for pipeline" do
+    Thread.current[:user] = users(:admin)
+
     pi = pipeline_instances :new_pipeline
 
     # add a component with no input and expect state to be New
@@ -52,7 +56,7 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     assert_equal pi.components.size, 1, 'expected one component'
     assert !pi.active, 'expected active to be false after update'
     assert !pi.success, 'expected success to be false for a new pipeline'
-   
+
     pi.active = true
     pi.save
     pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
@@ -112,7 +116,10 @@ class PipelineInstanceTest < ActiveSupport::TestCase
     pi.components['first'] = component1
     pi.components['second'] = component2
     components = pi.components
+
+    Thread.current[:user] = users(:admin)
     pi.update_attribute 'components', pi.components
+
     pi = PipelineInstance.find_by_uuid 'zzzzz-xxxxx-f4gneyn6br1xize'
     assert_equal PipelineInstance::New, pi.state, 'expected state to be New after adding component with input'
     assert_equal pi.components.size, 2, 'expected two components'