@@ -31,13 +31,9 @@ class ContentViewManagerTest < ActiveSupport::TestCase
3131 cvv = katello_content_view_versions ( :composite_view_version_1 )
3232
3333 # Create a scheduled publish task for the composite CV
34- task = ForemanTasks ::Task . create! (
35- type : 'ForemanTasks::Task::DynflowTask' ,
36- label : 'Actions::Katello::ContentView::Publish' ,
37- state : 'scheduled' ,
38- result : 'pending' ,
39- external_id : 'test-scheduled-publish-123'
40- )
34+ task = FactoryBot . create ( :dynflow_task , :scheduled ,
35+ label : 'Actions::Katello::ContentView::Publish' ,
36+ external_id : 'test-scheduled-publish-123' )
4137
4238 # Mock the delayed plan to return our composite CV as first arg
4339 delayed_plan = mock ( 'delayed_plan' )
@@ -55,7 +51,7 @@ class ContentViewManagerTest < ActiveSupport::TestCase
5551
5652 request . expects ( :with_lock ) . yields
5753 request . expects ( :destroy! )
58- Katello ::ContentViewManager . expects ( :running_component_publish_task_ids ) . returns ( [ ] )
54+ Katello ::ContentViewManager . expects ( :running_component_publish_tasks ) . returns ( [ ] )
5955 ForemanTasks . expects ( :async_task ) . with (
6056 ::Actions ::Katello ::ContentView ::Publish ,
6157 request . content_view ,
@@ -69,15 +65,13 @@ class ContentViewManagerTest < ActiveSupport::TestCase
6965
7066 test 'trigger_auto_publish with chaining' do
7167 request = build_stubbed ( :katello_content_view_auto_publish_request )
72- sibling_task_ids = [ 'task-1' , 'task-2' ]
73- mock_world = mock ( 'world' )
68+ sibling_tasks = [ mock ( 'task1' ) , mock ( 'task2' ) ]
7469
7570 request . expects ( :with_lock ) . yields
7671 request . expects ( :destroy! )
77- Katello ::ContentViewManager . expects ( :running_component_publish_task_ids ) . returns ( sibling_task_ids )
78- ForemanTasks . dynflow . expects ( :world ) . returns ( mock_world )
79- mock_world . expects ( :chain ) . with (
80- sibling_task_ids ,
72+ Katello ::ContentViewManager . expects ( :running_component_publish_tasks ) . returns ( sibling_tasks )
73+ ForemanTasks . expects ( :chain ) . with (
74+ sibling_tasks ,
8175 Actions ::Katello ::ContentView ::Publish ,
8276 request . content_view ,
8377 anything ,
@@ -104,7 +98,7 @@ class ContentViewManagerTest < ActiveSupport::TestCase
10498
10599 request . expects ( :with_lock ) . yields
106100 request . expects ( :destroy! ) . never
107- Katello ::ContentViewManager . expects ( :running_component_publish_task_ids ) . returns ( [ ] )
101+ Katello ::ContentViewManager . expects ( :running_component_publish_tasks ) . returns ( [ ] )
108102 ForemanTasks . expects ( :async_task ) . raises ( ForemanTasks ::Lock ::LockConflict . new ( mock , [ ] ) )
109103
110104 Katello ::ContentViewManager . trigger_auto_publish! ( request : request )
@@ -114,7 +108,7 @@ class ContentViewManagerTest < ActiveSupport::TestCase
114108 request = build_stubbed ( :katello_content_view_auto_publish_request )
115109
116110 request . expects ( :with_lock ) . yields
117- Katello ::ContentViewManager . expects ( :running_component_publish_task_ids ) . returns ( [ ] )
111+ Katello ::ContentViewManager . expects ( :running_component_publish_tasks ) . returns ( [ ] )
118112 ForemanTasks . expects ( :async_task ) . raises ( StandardError )
119113
120114 assert_raises ( StandardError ) do
0 commit comments