Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #13368 - add search by description for activation keys #5726

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/katello/activation_key.rb
Expand Up @@ -56,6 +56,7 @@ class ActivationKey < Katello::Model
scoped_search :rename => :environment, :on => :name, :in => :environment, :complete_value => true
scoped_search :rename => :content_view, :on => :name, :in => :content_view, :complete_value => true
scoped_search :on => :content_view_id, :complete_value => true
scoped_search :on => :description, :complete_value => true

def environment_exists
if environment_id && environment.nil?
Expand Down
5 changes: 5 additions & 0 deletions test/models/activation_key_test.rb
Expand Up @@ -102,6 +102,11 @@ def test_search_content_view_id
assert_includes activation_keys, @dev_staging_view_key
end

def test_search_description
activation_keys = ActivationKey.search_for("description = \"#{@dev_staging_view_key.description}\"")
assert_includes activation_keys, @dev_staging_view_key
end

def test_valid_content_label?
@dev_key.stubs(:available_content).returns([OpenStruct.new(:content => OpenStruct.new(:label => 'some-label'))])
assert @dev_key.valid_content_label?('some-label')
Expand Down