Sha256: baafc32b6be0ad6a120d9110f179a479d74a552082cb3dd2fcc5970eb9841dab

Contents?: true

Size: 745 Bytes

Versions: 5

Compression:

Stored size: 745 Bytes

Contents

require 'test_helper'

class StatisticsControllerTest < ActionController::TestCase

  test 'user with viewer rights should succeed in viewing statistics' do
    @request.session[:user] = users(:one).id
    users(:one).roles = [Role.find_by_name('Anonymous'), Role.find_by_name('Viewer')]
    get :index, {}, set_session_user
    assert_response :success
  end

  test 'index_json' do
    get :index, {:format => "json"}, set_session_user
    assert_response :success
    stats = ActiveSupport::JSON.decode(@response.body)
    assert stats.is_a?(Hash)
    %w{os_count arch_count env_count klass_count cpu_count model_count mem_size mem_free swap_size swap_free}.each do |stat|
          assert_not_nil stats["statistics"][stat]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/test/functional/statistics_controller_test.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/test/functional/statistics_controller_test.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/test/functional/statistics_controller_test.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/test/functional/statistics_controller_test.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/test/functional/statistics_controller_test.rb