Skip to content

Commit

Permalink
Fixes #34528 - Show puppet module count on composite cv add page
Browse files Browse the repository at this point in the history
  • Loading branch information
chris1984 committed Mar 8, 2022
1 parent a7d948a commit f60f119
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/katello/content_view_version.rb
Expand Up @@ -167,6 +167,10 @@ def promote_puppet_environment?
(!content_counts.blank? && content_counts.dig(PuppetModule::CONTENT_TYPE) > 0) || self.content_view.force_puppet_environment?
end

def puppet_module_count
content_counts&.dig(PuppetModule::CONTENT_TYPE)
end

def archived_repos
self.default? ? self.repositories : self.repos(nil)
end
Expand Down
2 changes: 1 addition & 1 deletion test/models/content_view_version_test.rb
Expand Up @@ -196,7 +196,6 @@ def test_with_puppet_module
katello_content_view_puppet_environments(:library_dev_staging_view_library_puppet_env).puppet_modules << puppet_module
puppet_cv_env = katello_content_view_puppet_environments(:dev_view_puppet_environment)
puppet_cv_env.puppet_modules << puppet_module

assert_include ContentViewVersion.with_puppet_module(puppet_module), puppet_cv_env.content_view_version
end

Expand All @@ -208,6 +207,7 @@ def test_promote_puppet_environment?

@cvv.content_view.force_puppet_environment = false
@cvv.content_counts = { "puppet_module" => 2 }
assert_equal 2, @cvv.puppet_module_count
assert @cvv.promote_puppet_environment?
end

Expand Down

0 comments on commit f60f119

Please sign in to comment.