foreman_statistics 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +619 -0
  3. data/README.md +40 -0
  4. data/Rakefile +47 -0
  5. data/app/controllers/concerns/foreman_statistics/parameters/trend.rb +20 -0
  6. data/app/controllers/foreman_statistics/api/v2/statistics_controller.rb +33 -0
  7. data/app/controllers/foreman_statistics/api/v2/trends_controller.rb +58 -0
  8. data/app/controllers/foreman_statistics/react_controller.rb +19 -0
  9. data/app/controllers/foreman_statistics/statistics_controller.rb +24 -0
  10. data/app/controllers/foreman_statistics/trends_controller.rb +58 -0
  11. data/app/helpers/foreman_statistics/trends_helper.rb +53 -0
  12. data/app/models/concerns/foreman_statistics/compute_resource_decorations.rb +9 -0
  13. data/app/models/concerns/foreman_statistics/environment_decorations.rb +9 -0
  14. data/app/models/concerns/foreman_statistics/general_setting_decorations.rb +17 -0
  15. data/app/models/concerns/foreman_statistics/hostgroup_decorations.rb +9 -0
  16. data/app/models/concerns/foreman_statistics/model_decorations.rb +9 -0
  17. data/app/models/concerns/foreman_statistics/operatingsystem_decorations.rb +9 -0
  18. data/app/models/concerns/foreman_statistics/setting_decorations.rb +9 -0
  19. data/app/models/foreman_statistics/fact_trend.rb +57 -0
  20. data/app/models/foreman_statistics/foreman_trend.rb +41 -0
  21. data/app/models/foreman_statistics/trend.rb +38 -0
  22. data/app/models/foreman_statistics/trend_counter.rb +11 -0
  23. data/app/services/foreman_statistics/statistics.rb +21 -0
  24. data/app/services/foreman_statistics/statistics/base.rb +39 -0
  25. data/app/services/foreman_statistics/statistics/count_facts.rb +17 -0
  26. data/app/services/foreman_statistics/statistics/count_hosts.rb +9 -0
  27. data/app/services/foreman_statistics/statistics/count_numerical_fact_pair.rb +43 -0
  28. data/app/services/foreman_statistics/statistics/count_puppet_classes.rb +23 -0
  29. data/app/services/foreman_statistics/trend_importer.rb +63 -0
  30. data/app/views/foreman_statistics/api/v2/trends/base.json.rabl +4 -0
  31. data/app/views/foreman_statistics/api/v2/trends/create.json.rabl +3 -0
  32. data/app/views/foreman_statistics/api/v2/trends/index.json.rabl +3 -0
  33. data/app/views/foreman_statistics/api/v2/trends/main.json.rabl +5 -0
  34. data/app/views/foreman_statistics/api/v2/trends/show.json.rabl +3 -0
  35. data/app/views/foreman_statistics/api/v2/trends/update.json.rabl +3 -0
  36. data/app/views/foreman_statistics/layouts/application_react.html.erb +16 -0
  37. data/app/views/foreman_statistics/trends/_empty_data.html.erb +7 -0
  38. data/app/views/foreman_statistics/trends/_fields.html.erb +7 -0
  39. data/app/views/foreman_statistics/trends/_form.html.erb +8 -0
  40. data/app/views/foreman_statistics/trends/_hosts.html.erb +13 -0
  41. data/app/views/foreman_statistics/trends/edit.html.erb +46 -0
  42. data/app/views/foreman_statistics/trends/index.html.erb +39 -0
  43. data/app/views/foreman_statistics/trends/new.html.erb +4 -0
  44. data/app/views/foreman_statistics/trends/show.html.erb +25 -0
  45. data/app/views/foreman_statistics/trends/welcome.html.erb +12 -0
  46. data/config/routes.rb +22 -0
  47. data/db/migrate/20200605153005_migrate_core_types.rb +15 -0
  48. data/db/migrate_foreman/20121012170851_create_trends.rb +25 -0
  49. data/db/migrate_foreman/20121012170936_create_trend_counters.rb +14 -0
  50. data/db/migrate_foreman/20150202094307_add_range_to_trend_counters.rb +6 -0
  51. data/db/migrate_foreman/20181031155025_add_trend_counter_created_at_unique_constraint.rb +9 -0
  52. data/lib/foreman_statistics.rb +4 -0
  53. data/lib/foreman_statistics/engine.rb +104 -0
  54. data/lib/foreman_statistics/version.rb +3 -0
  55. data/lib/tasks/foreman_statistics_tasks.rake +78 -0
  56. data/locale/Makefile +60 -0
  57. data/locale/en/foreman_statistics.po +19 -0
  58. data/locale/foreman_statistics.pot +19 -0
  59. data/locale/gemspec.rb +2 -0
  60. data/test/factories/foreman_statistics_factories.rb +68 -0
  61. data/test/fixtures/permissions.yml +26 -0
  62. data/test/fixtures/settings.yml +6 -0
  63. data/test/functional/foreman_statistics/api/v2/statistics_controller_test.rb +19 -0
  64. data/test/functional/foreman_statistics/api/v2/trends_controller_test.rb +74 -0
  65. data/test/functional/foreman_statistics/statistics_controller_test.rb +23 -0
  66. data/test/functional/foreman_statistics/trends_controller_test.rb +115 -0
  67. data/test/models/foreman_statistics/trend_counter_test.rb +10 -0
  68. data/test/models/foreman_statistics/trend_test.rb +22 -0
  69. data/test/test_plugin_helper.rb +6 -0
  70. data/test/unit/foreman_statistics/access_permissions_test.rb +16 -0
  71. data/test/unit/foreman_statistics/statistics_test.rb +82 -0
  72. data/test/unit/foreman_statistics_test.rb +11 -0
  73. data/test/unit/tasks/foreman_statistics_tasks_test.rb +205 -0
  74. metadata +199 -0
@@ -0,0 +1,60 @@
1
+ #
2
+ # Makefile for PO merging and MO generation. More info in the README.
3
+ #
4
+ # make all-mo (default) - generate MO files
5
+ # make check - check translations using translate-tool
6
+ # make tx-update - download and merge translations from Transifex
7
+ # make clean - clean everything
8
+ #
9
+ DOMAIN = foreman_statistics
10
+ VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load(Dir.glob("../*.gemspec")[0]);puts spec.version')
11
+ POTFILE = $(DOMAIN).pot
12
+ MOFILE = $(DOMAIN).mo
13
+ POFILES = $(shell find . -name '$(DOMAIN).po')
14
+ MOFILES = $(patsubst %.po,%.mo,$(POFILES))
15
+ POXFILES = $(patsubst %.po,%.pox,$(POFILES))
16
+ EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
17
+
18
+ %.mo: %.po
19
+ mkdir -p $(shell dirname $@)/LC_MESSAGES
20
+ msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
21
+
22
+ # Generate MO files from PO files
23
+ all-mo: $(MOFILES)
24
+
25
+ # Check for malformed strings
26
+ %.pox: %.po
27
+ msgfmt -c $<
28
+ pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
29
+ -t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
30
+ cat $@
31
+ ! grep -q msgid $@
32
+
33
+ %.edit.po:
34
+ touch $@
35
+
36
+ check: $(POXFILES)
37
+
38
+ # Unify duplicate translations
39
+ uniq-po:
40
+ for f in $(shell find ./ -name "*.po") ; do \
41
+ msguniq $$f -o $$f ; \
42
+ done
43
+
44
+ tx-pull: $(EDITFILES)
45
+ tx pull -f
46
+ for f in $(EDITFILES) ; do \
47
+ sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
48
+ done
49
+
50
+ tx-update: tx-pull
51
+ @echo
52
+ @echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation, then make -C locale mo-files to finish
53
+ @echo
54
+
55
+ mo-files: $(MOFILES)
56
+ git add $(POFILES) $(POTFILE) ../locale/*/LC_MESSAGES
57
+ git commit -m "i18n - pulling from tx"
58
+ @echo
59
+ @echo Changes commited!
60
+ @echo
@@ -0,0 +1,19 @@
1
+ # foreman_statistics
2
+ #
3
+ # This file is distributed under the same license as foreman_statistics.
4
+ #
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: version 0.0.1\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2014-08-20 08:46+0100\n"
11
+ "PO-Revision-Date: 2014-08-20 08:54+0100\n"
12
+ "Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
13
+ "Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
14
+ "Language: \n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+
@@ -0,0 +1,19 @@
1
+ # foreman_statistics
2
+ #
3
+ # This file is distributed under the same license as foreman_statistics.
4
+ #
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: version 0.0.1\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "POT-Creation-Date: 2014-08-20 08:46+0100\n"
11
+ "PO-Revision-Date: 2014-08-20 08:46+0100\n"
12
+ "Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
13
+ "Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
14
+ "Language: \n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
19
+
@@ -0,0 +1,2 @@
1
+ # Matches foreman_statistics.gemspec
2
+ _('TODO: Description of ForemanStatistics.')
@@ -0,0 +1,68 @@
1
+ FactoryBot.define do
2
+ factory :foreman_statistics_trend, :class => ForemanStatistics::Trend do
3
+ sequence(:name) { |n| "trend#{n}" }
4
+ sequence(:trendable_id)
5
+
6
+ trait :value do # trend for one value of a fact
7
+ name { nil }
8
+ sequence(:fact_value) { |n| "value #{n}" }
9
+ end
10
+
11
+ transient do
12
+ counter_count { 0 }
13
+ end
14
+ trait :with_counters do
15
+ counter_count { 2 }
16
+ end
17
+
18
+ after(:create) do |trend, evaluator|
19
+ # only trends for a certain value have counters
20
+ if trend.fact_value.present?
21
+ trend.trend_counters = (0...evaluator.counter_count).map do |idx|
22
+ FactoryBot.build(:foreman_statistics_trend_counter, trend: trend, created_at: Time.zone.now - idx.minutes)
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ factory :foreman_statistics_foreman_trend, :class => ForemanStatistics::ForemanTrend, :parent => :foreman_statistics_trend do
29
+ transient do
30
+ with_values { false }
31
+ end
32
+ trait :with_values do
33
+ with_values { true }
34
+ end
35
+
36
+ factory :foreman_statistics_trend_os do
37
+ trendable_type { 'Operatingsystem' }
38
+ sequence(:name) { |n| "OS#{n}" }
39
+
40
+ before(:create) do |trend, evaluator|
41
+ if evaluator.with_values && trend.name.present?
42
+ FactoryBot.create_list(:operatingsystem, 3).each do |os|
43
+ FactoryBot.create(:foreman_statistics_trend_os, :value, :trendable_id => os.id, :fact_value => os.to_s, :counter_count => evaluator.counter_count)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ factory :foreman_statistics_fact_trend, :class => ForemanStatistics::FactTrend, :parent => :foreman_statistics_trend do
51
+ trendable_type { 'FactName' }
52
+ trendable { FactoryBot.create(:fact_name) }
53
+
54
+ trait :with_values do
55
+ before(:create) do |trend, evaluator|
56
+ if trend.name.present?
57
+ FactoryBot.create_list(:fact_value, 3, :fact_name => trend.trendable).each do |fact|
58
+ FactoryBot.create(:foreman_statistics_fact_trend, :value, :trendable_id => trend.trendable_id, :fact_name => trend.trendable.name, :fact_value => fact.value, :counter_count => evaluator.counter_count)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ factory :foreman_statistics_trend_counter, :class => ForemanStatistics::TrendCounter do
66
+ sequence(:count) { |n| n }
67
+ end
68
+ end
@@ -0,0 +1,26 @@
1
+ ---
2
+ view_trends:
3
+ name: view_trends
4
+ resource_type: Trend
5
+ created_at: "2013-12-04 08:41:06.282474"
6
+ updated_at: "2013-12-04 08:41:06.282474"
7
+ create_trends:
8
+ name: create_trends
9
+ resource_type: Trend
10
+ created_at: "2013-12-04 08:41:06.290854"
11
+ updated_at: "2013-12-04 08:41:06.290854"
12
+ edit_trends:
13
+ name: edit_trends
14
+ resource_type: Trend
15
+ created_at: "2013-12-04 08:41:06.299794"
16
+ updated_at: "2013-12-04 08:41:06.299794"
17
+ destroy_trends:
18
+ name: destroy_trends
19
+ resource_type: Trend
20
+ created_at: "2013-12-04 08:41:06.307322"
21
+ updated_at: "2013-12-04 08:41:06.307322"
22
+ update_trends:
23
+ name: update_trends
24
+ resource_type: Trend
25
+ created_at: "2013-12-04 08:41:06.315986"
26
+ updated_at: "2013-12-04 08:41:06.315986"
@@ -0,0 +1,6 @@
1
+ ---
2
+ attributes60:
3
+ name: max_trend
4
+ category: Setting::General
5
+ default: 30
6
+ description: 'Max days for Trends graphs'
@@ -0,0 +1,19 @@
1
+ require_relative '../../../../test_plugin_helper'
2
+
3
+ class ForemanStatistics::Api::V2::StatisticsControllerTest < ActionController::TestCase
4
+ setup do
5
+ @routes = ForemanStatistics::Engine.routes
6
+ end
7
+
8
+ test 'should get statistics' do
9
+ get :index
10
+ assert_response :success
11
+ response = ActiveSupport::JSON.decode(@response.body)
12
+ assert_not response.empty?
13
+ expected_keys = %w[arch_count cpu_count env_count klass_count
14
+ mem_free mem_size mem_totfree mem_totsize
15
+ model_count os_count swap_free swap_size]
16
+
17
+ assert_equal expected_keys, response.keys.sort
18
+ end
19
+ end
@@ -0,0 +1,74 @@
1
+ require_relative '../../../../test_plugin_helper'
2
+
3
+ class ForemanStatistics::Api::V2::TrendsControllerTest < ActionController::TestCase
4
+ setup do
5
+ @routes = ForemanStatistics::Engine.routes
6
+
7
+ FactoryBot.create(:fact_value, :value => '2.6.9', :host => host,
8
+ :fact_name => FactoryBot.create(:fact_name, :name => 'kernelversion'))
9
+ end
10
+
11
+ let(:host) { FactoryBot.create(:host) }
12
+ let(:foreman_trend) { FactoryBot.create(:foreman_statistics_foreman_trend, :trendable_type => 'Environment', :fact_name => 'fact') }
13
+ let(:fact_trend) { FactoryBot.create(:foreman_statistics_fact_trend, :trendable_type => 'FactName') }
14
+ let(:os_fact) do
15
+ FactoryBot.create(:fact_value, :value => 'fedora', :host => host,
16
+ :fact_name => FactoryBot.create(:fact_name, :name => 'operatingsystem'))
17
+ end
18
+ let(:foreman_trend_invalid_attrs) { { :trendable_type => 'NotExists' } }
19
+ let(:fact_trend_valid_attrs) { { :trendable_type => 'FactName', :trendable_id => os_fact.fact_name_id.to_s } }
20
+
21
+ test 'should get index' do
22
+ expected = [foreman_trend.fact_name, fact_trend.fact_name]
23
+ get :index, params: {}
24
+ assert_response :success
25
+ assert_not_nil assigns(:trends)
26
+ trends = ActiveSupport::JSON.decode(@response.body)
27
+ assert_equal expected.sort, trends['results'].map { |t| t['fact_name'] }.sort
28
+ end
29
+
30
+ test 'should create a valid foreman trend' do
31
+ foreman_trend; fact_trend; os_fact
32
+ assert_difference('ForemanStatistics::Trend.types.where(:type => "ForemanStatistics::ForemanTrend").count', 1) do
33
+ post :create, params: { :trend => { :trendable_type => 'Model' } }
34
+ assert_response :created
35
+ result = ActiveSupport::JSON.decode(@response.body)
36
+ assert_equal('Model', result['trendable_type'])
37
+ assert_equal('ForemanStatistics::ForemanTrend', result['type'])
38
+ end
39
+ end
40
+
41
+ test 'should create a valid fact trend' do
42
+ assert_difference('ForemanStatistics::Trend.types.where(:type => "ForemanStatistics::FactTrend").count', 1) do
43
+ post :create, params: { :trend => fact_trend_valid_attrs }
44
+ assert_response :created
45
+ result = ActiveSupport::JSON.decode(@response.body)
46
+ assert_equal('FactName', result['trendable_type'])
47
+ assert_equal('operatingsystem', result['fact_name'])
48
+ assert_equal('ForemanStatistics::FactTrend', result['type'])
49
+ end
50
+ end
51
+
52
+ test 'should not create invalid trends' do
53
+ assert_no_difference('ForemanStatistics::Trend.types.count') do
54
+ post :create, params: { :trend => foreman_trend_invalid_attrs }
55
+ end
56
+ assert_response :error
57
+ end
58
+
59
+ test 'should show individual record' do
60
+ get :show, params: { :id => foreman_trend.id.to_param }
61
+ assert_response :success
62
+ show_response = ActiveSupport::JSON.decode(@response.body)
63
+ assert_equal foreman_trend.trendable_type, show_response['trendable_type']
64
+ end
65
+
66
+ test 'should destroy trends ' do
67
+ foreman_trend; fact_trend
68
+ assert_difference('ForemanStatistics::Trend.types.count', -2) do
69
+ delete :destroy, params: { :id => foreman_trend.id.to_param }
70
+ delete :destroy, params: { :id => fact_trend.id.to_param }
71
+ end
72
+ assert_response :success
73
+ end
74
+ end
@@ -0,0 +1,23 @@
1
+ require_relative '../../test_plugin_helper'
2
+
3
+ module ForemanStatistics
4
+ class StatisticsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @routes = ForemanStatistics::Engine.routes
7
+ end
8
+
9
+ test 'user with viewer rights should succeed in viewing statistics' do
10
+ @request.session[:user] = users(:one).id
11
+ users(:one).roles = [Role.default, Role.find_by(name: 'Viewer')]
12
+ get :index, session: set_session_user
13
+ assert_response :success
14
+ end
15
+
16
+ test 'user with viewer rights should succeed in requesting statistics data via ajax' do
17
+ @request.session[:user] = users(:one).id
18
+ users(:one).roles = [Role.default, Role.find_by(name: 'Viewer')]
19
+ get :show, params: { :id => 'operatingsystem', :format => 'json' }, session: set_session_user
20
+ assert_response :success
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,115 @@
1
+ require_relative '../../test_plugin_helper'
2
+
3
+ module ForemanStatistics
4
+ class TrendsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @routes = ForemanStatistics::Engine.routes
7
+ Setting::General.create(:name => 'max_trend', :default => 30, :description => 'Max days for Trends graphs')
8
+ end
9
+
10
+ let(:os_trend) { FactoryBot.create(:foreman_statistics_trend_os) }
11
+ let(:os_trend_with_counters) do
12
+ FactoryBot.create(:foreman_statistics_trend_os, :with_values, :with_counters)
13
+ end
14
+
15
+ describe 'GET #index' do
16
+ setup do
17
+ @old = Setting[:entries_per_page]
18
+ Setting[:entries_per_page] = entries_per_page
19
+ end
20
+ teardown do
21
+ Setting[:entries_per_page] = @old
22
+ end
23
+
24
+ describe 'pagination rendered' do
25
+ setup { os_trend }
26
+ let(:entries_per_page) { 1 }
27
+
28
+ test 'should not render pagination' do
29
+ get :index, session: set_session_user
30
+ assert_response :success
31
+ assert_not_includes @response.body, 'id=pagination'
32
+ end
33
+
34
+ test 'should render pagination' do
35
+ get :index, session: set_session_user
36
+ assert_response :success
37
+ assert_select "div[id='pagination']"
38
+ end
39
+ end
40
+
41
+ describe 'pagination per page' do
42
+ setup { trends }
43
+ let(:entries_per_page) { 5 }
44
+ let(:trends) { FactoryBot.create_list(:foreman_statistics_trend_os, entries_per_page + 2) }
45
+
46
+ test 'should render correct per_page value' do
47
+ get :index, params: { per_page: entries_per_page + 1 }, session: set_session_user
48
+ assert_response :success
49
+ per_page_results = response.body.scan(/perPage":\d+/).first.gsub(/[^\d]/, '').to_i
50
+ assert_equal entries_per_page, per_page_results
51
+ end
52
+
53
+ test 'should render per page dropdown with correct values' do
54
+ get :index, params: { per_page: entries_per_page + 1 }, session: set_session_user
55
+ assert_response :success
56
+ assert_not_nil response.body['perPageOptions":[5,6,10,15,25,50]']
57
+ end
58
+
59
+ test 'sort links should include per page param' do
60
+ get :index, params: { per_page: entries_per_page + 1 }, session: set_session_user
61
+ assert_response :success
62
+ sort_links = css_select('thead a')
63
+ sort_links.each do |link|
64
+ assert_includes link['href'], "per_page=#{entries_per_page + 1}"
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ test 'should get empty_data page, if no trend counters exist' do
71
+ get :show, params: { :id => os_trend.id }, session: set_session_user
72
+ assert_response :success
73
+ assert_template :partial => 'foreman_statistics/trends/_empty_data'
74
+ end
75
+
76
+ test 'should show Foreman model trend' do
77
+ get :show, params: { :id => os_trend_with_counters.id }, session: set_session_user
78
+ assert_response :success
79
+ assert_template 'show'
80
+ end
81
+
82
+ test 'should show Foreman model trend value details' do
83
+ trend_value = os_trend_with_counters.values.find { |t| t.trend_counters.any? }
84
+ get :show, params: { :id => trend_value.id }, session: set_session_user
85
+ assert_response :success
86
+ assert_template 'show'
87
+ end
88
+
89
+ test 'should show fact trend' do
90
+ get :show, params: { :id => os_trend_with_counters.id }, session: set_session_user
91
+ assert_response :success
92
+ assert_template 'show'
93
+ end
94
+
95
+ test 'should show fact trend value details' do
96
+ trend_value = os_trend_with_counters.values.find { |t| t.trend_counters.any? }
97
+ get :show, params: { :id => trend_value.id }, session: set_session_user
98
+ assert_response :success
99
+ assert_template 'show'
100
+ end
101
+
102
+ test 'should create trend' do
103
+ trend_parameters = { :name => 'test', :fact_name => 'os',
104
+ :fact_value => 'fedora', :trendable_type => 'FactName' }
105
+ post :create, params: { :trend => trend_parameters }, session: set_session_user
106
+ assert_response :success
107
+ end
108
+
109
+ test 'should update trend' do
110
+ put :edit, params: { :id => os_trend.id, :trend => { :name => 'test2' } },
111
+ session: set_session_user
112
+ assert_response :success
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ module ForemanStatistics
4
+ class TrendCounterTest < ActiveSupport::TestCase
5
+ # Replace this with your real tests.
6
+ test 'the truth' do
7
+ assert true
8
+ end
9
+ end
10
+ end