Project

General

Profile

« Previous | Next » 

Revision a333a273

Added by Stephen Benjamin almost 6 years ago

fixes #23954 - test stubs should return dynflow task

ForemanTask.async_task returns a dynflow task, and tests that stub this
should also return the same class of object. ForemanTask::Task doesn't
have all the same methods as Task::DynflowTask, e.g. get_humanized.

View differences:

test/lib/tasks/repository_test.rb
def test_regenerate_repo_metadata
ForemanTasks.expects(:async_task).with(::Actions::Katello::Repository::BulkMetadataGenerate,
Katello::Repository.all.order(:name)).returns(ForemanTasks::Task.new)
Katello::Repository.all.order(:name)).returns(ForemanTasks::Task::DynflowTask::DynflowTask.new)
Rake.application.invoke_task('katello:regenerate_repo_metadata')
end
......
expected_repos = Katello::Repository.in_environment(@library_repo.environment).order(:name)
Katello::Repository.stubs(:in_environment).returns(expected_repos)
ForemanTasks.expects(:async_task).with(::Actions::Katello::Repository::BulkMetadataGenerate,
expected_repos).returns(ForemanTasks::Task.new)
expected_repos).returns(ForemanTasks::Task::DynflowTask.new)
Rake.application.invoke_task('katello:regenerate_repo_metadata')
end
......
def test_regenerate_repo_metadata_cv
ENV['CONTENT_VIEW'] = @cv_repo.content_view.name
ForemanTasks.expects(:async_task).with(::Actions::Katello::Repository::BulkMetadataGenerate,
[@cv_repo]).returns(ForemanTasks::Task.new)
[@cv_repo]).returns(ForemanTasks::Task::DynflowTask.new)
Rake.application.invoke_task('katello:regenerate_repo_metadata')
end
def test_refresh_pulp_repo_details
ForemanTasks.expects(:async_task).with(::Actions::BulkAction, Actions::Katello::Repository::RefreshRepository,
Katello::Repository.all.order(:name)).returns(ForemanTasks::Task.new)
Katello::Repository.all.order(:name)).returns(ForemanTasks::Task::DynflowTask.new)
Rake.application.invoke_task('katello:refresh_pulp_repo_details')
end

Also available in: Unified diff