Skip to content

Commit

Permalink
feat(test): Migrate access permissions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laugmanuel committed Mar 19, 2024
1 parent 861f54c commit 5eb6de2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/foreman_wreckingball/cpu_hot_add_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.host_association
end

def self.description
N_('Enabling CPU hot-add disables vNUMA, the virtual machine will instead use UMA. This might cause a performance degration.') # rubocop:disable Metrics/LineLength
N_('Enabling CPU hot-add disables vNUMA, the virtual machine will instead use UMA. This might cause a performance degration.') # rubocop:disable Layout/LineLength
end

def self.supports_remediate?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def import!
delete_removed_clusters
create_new_clusters
end
logger.info("Import clusters for '#{compute_resource}' completed. Added: #{counters[:added] || 0}, Updated: #{counters[:updated] || 0}, Deleted: #{counters[:deleted] || 0} clusters") # rubocop:disable Metrics/LineLength
logger.info("Import clusters for '#{compute_resource}' completed. Added: #{counters[:added] || 0}, Updated: #{counters[:updated] || 0}, Deleted: #{counters[:deleted] || 0} clusters") # rubocop:disable Layout/LineLength
end

def delete_removed_clusters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def import!
import_hypervisors(cluster)
delete_removed_hypervisors(cluster)
end
logger.info("Import hypervisors for '#{compute_resource}' completed. Added: #{counters[:added] || 0}, Updated: #{counters[:updated] || 0}, Deleted: #{counters[:deleted] || 0} hypervisors") # rubocop:disable Metrics/LineLength
logger.info("Import hypervisors for '#{compute_resource}' completed. Added: #{counters[:added] || 0}, Updated: #{counters[:updated] || 0}, Deleted: #{counters[:deleted] || 0} hypervisors") # rubocop:disable Layout/LineLength
end

def import_hypervisors(cluster)
Expand Down
18 changes: 18 additions & 0 deletions test/unit/foreman_wreckingball/access_permissions_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

require 'test_plugin_helper'
require 'unit/shared/access_permissions_test_base'

# Permissions are added in AccessPermissions with lists of controllers and
# actions that they enable access to. For non-admin users, we need to test
# that there are permissions available that cover every controller action, else
# it can't be delegated and this will lead to parts of the application that
# aren't functional for non-admin users.
#
# In particular, it's important that actions for AJAX requests are added to
# an appropriate permission so views using those requests function.
class AccessPermissionsTest < ActiveSupport::TestCase
include AccessPermissionsTestBase

check_routes(ForemanWreckingball::Engine.routes, [])
end

0 comments on commit 5eb6de2

Please sign in to comment.