foreman_rh_cloud 0.9.5 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +0 -1
  3. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +7 -14
  4. data/config/routes.rb +0 -1
  5. data/lib/foreman_inventory_upload.rb +0 -12
  6. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +0 -8
  7. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +10 -5
  8. data/lib/foreman_inventory_upload/async/upload_report_job.rb +1 -5
  9. data/lib/foreman_inventory_upload/generators/archived_report.rb +3 -6
  10. data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
  11. data/lib/foreman_inventory_upload/generators/slice.rb +4 -20
  12. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -0
  13. data/lib/foreman_rh_cloud/engine.rb +1 -5
  14. data/lib/foreman_rh_cloud/version.rb +1 -1
  15. data/package.json +20 -100
  16. data/test/controllers/accounts_controller_test.rb +3 -8
  17. data/test/controllers/uploads_controller_test.rb +0 -13
  18. data/test/unit/slice_generator_test.rb +2 -45
  19. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +0 -2
  20. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +5 -14
  21. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +1 -2
  22. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +0 -8
  23. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +0 -2
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +1 -1
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +1 -1
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +1 -1
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +1 -1
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +1 -1
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +1 -1
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +1 -1
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +1 -12
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +2 -10
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +0 -10
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +2 -5
  35. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +13 -9
  36. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +5 -15
  37. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +1 -2
  38. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +15 -2
  39. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +2 -3
  40. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +1 -1
  41. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +1 -1
  42. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +1 -1
  43. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +1 -1
  44. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +5 -2
  45. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +1 -2
  46. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +1 -1
  47. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +1 -1
  48. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +1 -1
  49. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +0 -1
  50. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +2 -4
  51. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +2 -1
  52. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +2 -0
  53. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +1 -12
  54. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +1 -1
  55. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +1 -1
  56. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +1 -1
  57. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +1 -1
  58. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +1 -1
  59. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +1 -1
  60. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
  61. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -2
  62. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +4 -5
  63. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +1 -1
  64. data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +5 -6
  65. metadata +34 -28
  66. data/app/models/setting/rh_cloud.rb +0 -18
  67. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.fixtures.js +0 -1
  68. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +0 -32
  69. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +0 -27
  70. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js +0 -2
  71. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +0 -14
  72. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +0 -14
  73. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +0 -38
  74. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcherActions.test.js.snap +0 -14
  75. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +0 -3
  76. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/index.js +0 -17
  77. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +0 -21
  78. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/PageHeader.test.js +0 -13
  79. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +0 -33
  80. data/webpack/ForemanInventoryUpload/Components/PageHeader/index.js +0 -1
  81. data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
  82. data/webpack/stories/configureStore.js +0 -15
  83. data/webpack/stories/decorators/index.js +0 -1
  84. data/webpack/stories/decorators/withCardsDecorator.js +0 -14
  85. data/webpack/stories/index.js +0 -10
  86. data/webpack/stories/index.scss +0 -7
  87. data/webpack/test_setup.js +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d3adffa464bc496cf7b3d80bf897e5f9720f343316af3a32e61b99f55f41655
4
- data.tar.gz: fabb5e4334b5c9d9f6c17d5c44cc70a27afb165fc5e2684f0609a280b40a61db
3
+ metadata.gz: 1f6361a25739c19a67518378257d51f67fc443839d76d7d07f5bd597f09ef15d
4
+ data.tar.gz: b558ad39920b634ee4c9be77ec20f65235eb3193de374879dc85bc284a15bfa5
5
5
  SHA512:
6
- metadata.gz: 9eb34258b36236a537dfea9d5160f553cef3ffc4d39b2f95007cf4fab3d3d9aaaef29671cb056fcb73ade319ba847db47b9719c7fd5124f456a8d7ccca976481
7
- data.tar.gz: 8bb6f9bf92278d2ab534681fb6950c3169f1da6a5f543dcaa56946745ca6d626d3edd37c21d7d1d3ede5a30de5cc1790449c92e13f2859e99c756cadb9546e8d
6
+ metadata.gz: 83b2169b736d8c57d544b8ce53bda7e91e4741efdd384953fd32a22ac96e531282e97ef740112a7be5310ef44fc0569fe8995972304844302d0b2eb3db6215f8
7
+ data.tar.gz: 3b7bbd7d76a68b5b41874472961eabd2360de0ad871705430d7549d8c44b48e5811ba9d566d74a3c0a8774b7c3b4c0c5a0f75ae57f2f38519ef528e12239c4f3
@@ -25,7 +25,6 @@ module ForemanInventoryUpload
25
25
  ]
26
26
 
27
27
  render json: {
28
- autoUploadEnabled: Setting[:allow_auto_inventory_upload],
29
28
  accounts: accounts,
30
29
  }, status: :ok
31
30
  end
@@ -11,10 +11,14 @@ module ForemanInventoryUpload
11
11
 
12
12
  def download_file
13
13
  filename = ForemanInventoryUpload.facts_archive_name(params[:organization_id])
14
- files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]
14
+ path = Rails.root.join(ForemanInventoryUpload.uploads_folder, filename)
15
+ unless File.exist? path
16
+ return throw_flash_error(
17
+ "Path doesn't exist: #{path}"
18
+ )
19
+ end
15
20
 
16
- return send_file files.first, disposition: 'attachment', filename: filename unless files.empty?
17
- throw_flash_error "File doesn't exist"
21
+ send_file path, disposition: 'attachment', filename: filename
18
22
  end
19
23
 
20
24
  def throw_flash_error(message)
@@ -23,16 +27,5 @@ module ForemanInventoryUpload
23
27
  :error_msg => message
24
28
  )
25
29
  end
26
-
27
- def auto_upload
28
- Setting[:allow_auto_inventory_upload] = auto_upload_params
29
- render json: {
30
- autoUploadEnabled: Setting[:allow_auto_inventory_upload],
31
- }
32
- end
33
-
34
- def auto_upload_params
35
- ActiveModel::Type::Boolean.new.cast(params.require(:value))
36
- end
37
30
  end
38
31
  end
@@ -6,6 +6,5 @@ Rails.application.routes.draw do
6
6
  get ':organization_id/uploads/last', to: 'uploads#last', constraints: { organization_id: %r{[^\/]+} }
7
7
  get ':organization_id/uploads/file', to: 'uploads#download_file', constraints: { organization_id: %r{[^\/]+} }
8
8
  get 'accounts', to: 'accounts#index'
9
- post 'auto_upload', to: 'uploads#auto_upload'
10
9
  end
11
10
  end
@@ -18,18 +18,6 @@ module ForemanInventoryUpload
18
18
  )
19
19
  end
20
20
 
21
- def self.uploads_file_path(filename)
22
- File.join(ForemanInventoryUpload.uploads_folder, filename)
23
- end
24
-
25
- def self.done_folder
26
- File.join(ForemanInventoryUpload.uploads_folder, 'done/')
27
- end
28
-
29
- def self.done_file_path(filename)
30
- File.join(ForemanInventoryUpload.done_folder, filename)
31
- end
32
-
33
21
  def self.generated_reports_folder
34
22
  @generated_reports_folder ||= ensure_folder(
35
23
  File.join(
@@ -2,14 +2,6 @@ module ForemanInventoryUpload
2
2
  module Async
3
3
  class GenerateAllReportsJob < ::ApplicationJob
4
4
  def perform
5
- unless Setting[:allow_auto_inventory_upload]
6
- logger.debug(
7
- 'The scheduled process is disabled due to the "allow_auto_inventory_upload"
8
- setting being set to false.'
9
- )
10
- return
11
- end
12
-
13
5
  organizations = Organization.unscoped.all
14
6
 
15
7
  organizations.map do |organization|
@@ -30,11 +30,16 @@ module ForemanInventoryUpload
30
30
  def ensure_output_script
31
31
  return if File.exist?(script_file)
32
32
 
33
- script_source_file = File.join(ForemanRhCloud::Engine.root, 'lib/foreman_inventory_upload/scripts/uploader.sh.erb')
34
-
35
- script_source = File.read(script_source_file)
36
- script_source.gsub!('<%= @upload_url %>', ForemanInventoryUpload.upload_url)
37
-
33
+ script_source = File.join(ForemanRhCloud::Engine.root, 'lib/foreman_inventory_upload/scripts/uploader.sh.erb')
34
+
35
+ template_src = Foreman::Renderer::Source::String.new(content: File.read(script_source))
36
+ scope = Foreman::Renderer::Scope::Base.new(
37
+ source: template_src,
38
+ variables: {
39
+ upload_url: ForemanInventoryUpload.upload_url,
40
+ }
41
+ )
42
+ script_source = Foreman::Renderer.render(template_src, scope)
38
43
  File.write(script_file, script_source)
39
44
  FileUtils.chmod('+x', script_file)
40
45
  end
@@ -37,11 +37,7 @@ module ForemanInventoryUpload
37
37
  end
38
38
 
39
39
  def http_proxy_string
40
- @http_proxy_string ||= begin
41
- if Setting[:content_default_http_proxy]
42
- HttpProxy.unscoped.find_by(name: Setting[:content_default_http_proxy])&.full_url
43
- end
44
- end
40
+ @http_proxy_string ||= HttpProxy.default_global_content_proxy&.full_url
45
41
  end
46
42
 
47
43
  def rh_credentials
@@ -16,9 +16,9 @@ module ForemanInventoryUpload
16
16
  first = true
17
17
  host_batches.each do |hosts_batch|
18
18
  slice_id = Foreman.uuid
19
- @logger.info "Adding slice #{slice_id}"
20
- hosts_count = generate_slice(tmpdir, slice_id, hosts_batch)
21
- @logger.info "slice #{slice_id} was created with #{hosts_count} hosts"
19
+ hosts_count = hosts_batch.count
20
+ @logger.info "Adding slice #{slice_id} with #{hosts_count} hosts"
21
+ generate_slice(tmpdir, slice_id, hosts_batch)
22
22
  inner_generator.add_slice(slice_id, hosts_count, first)
23
23
  first = false
24
24
  end
@@ -43,13 +43,10 @@ module ForemanInventoryUpload
43
43
  private
44
44
 
45
45
  def generate_slice(tmpdir, slice_id, hosts_batch)
46
- hosts_count = 0
47
46
  File.open(File.join(tmpdir, "#{slice_id}.json"), 'w') do |slice_out|
48
47
  slice_generator = ForemanInventoryUpload::Generators::Slice.new(hosts_batch, slice_out, slice_id)
49
48
  slice_generator.render
50
- hosts_count = slice_generator.hosts_count
51
49
  end
52
- hosts_count
53
50
  end
54
51
  end
55
52
  end
@@ -18,7 +18,6 @@ module ForemanInventoryUpload
18
18
  'uname::release',
19
19
  'lscpu::flags',
20
20
  'distribution::version',
21
- 'distribution::id',
22
21
  ]).pluck(:name, :id)
23
22
  ]
24
23
  end
@@ -4,13 +4,11 @@ module ForemanInventoryUpload
4
4
  include FactHelpers
5
5
 
6
6
  attr_accessor :slice_id
7
- attr_reader :hosts_count
8
7
 
9
8
  def initialize(hosts, output = [], slice_id = Foreman.uuid)
10
9
  @stream = JsonStream.new(output)
11
10
  @hosts = hosts
12
11
  @slice_id = slice_id
13
- @hosts_count = 0
14
12
  end
15
13
 
16
14
  def render
@@ -28,10 +26,7 @@ module ForemanInventoryUpload
28
26
  hosts_batch.each do |host|
29
27
  next unless host&.subscription_facet&.pools&.first
30
28
  @stream.comma unless first
31
- if report_host(host)
32
- first = false
33
- @hosts_count += 1
34
- end
29
+ first = false if report_host(host)
35
30
  end
36
31
  end
37
32
  end
@@ -41,7 +36,7 @@ module ForemanInventoryUpload
41
36
  @stream.object do
42
37
  @stream.simple_field('display_name', host.name)
43
38
  @stream.simple_field('fqdn', host.fqdn)
44
- @stream.simple_field('account', host.subscription_facet.pools.where.not(account_number: nil).first&.account_number&.to_s)
39
+ @stream.simple_field('account', host.subscription_facet.pools.first.account_number.to_s)
45
40
  @stream.simple_field('subscription_manager_id', host.subscription_facet.uuid)
46
41
  @stream.simple_field('satellite_id', host.subscription_facet.uuid)
47
42
  @stream.simple_field('bios_uuid', fact_value(host, 'dmi::system::uuid'))
@@ -70,7 +65,7 @@ module ForemanInventoryUpload
70
65
 
71
66
  @stream.array_field('tags', :last) do
72
67
  report_tag('satellite', 'satellite_instance_id', Foreman.instance_id) if Foreman.respond_to?(:instance_id)
73
- report_tag('satellite', 'organization_id', host.organization_id.to_s, :last)
68
+ report_tag('satellite', 'organization_id', host.organization_id, :last)
74
69
  end
75
70
  end
76
71
  end
@@ -110,14 +105,7 @@ module ForemanInventoryUpload
110
105
  end.join(', '))
111
106
  end
112
107
  end
113
- @stream.simple_field(
114
- 'os_release',
115
- os_release_value(
116
- name: fact_value(host, 'distribution::name'),
117
- version: fact_value(host, 'distribution::version'),
118
- codename: fact_value(host, 'distribution::id')
119
- )
120
- )
108
+ @stream.simple_field('os_release', fact_value(host, 'distribution::name'))
121
109
  @stream.simple_field('os_kernel_version', fact_value(host, 'uname::release'))
122
110
  @stream.simple_field('arch', host.architecture&.name)
123
111
  @stream.simple_field('subscription_status', host.subscription_status_label)
@@ -154,10 +142,6 @@ module ForemanInventoryUpload
154
142
  @stream.simple_field('satellite_instance_id', Foreman.respond_to?(:instance_id) ? Foreman.instance_id : nil)
155
143
  @stream.simple_field('organization_id', host.organization_id, :last)
156
144
  end
157
-
158
- def os_release_value(name:, version:, codename:)
159
- "#{name} #{version} (#{codename})"
160
- end
161
145
  end
162
146
  end
163
147
  end
@@ -1,6 +1,7 @@
1
1
  #! /bin/sh
2
2
 
3
3
  DEST=<%= @upload_url %>
4
+ RH_USERNAME=<%= @rh_username %>
4
5
 
5
6
  if [ -z "$FILES" ]
6
7
  then
@@ -5,10 +5,6 @@ module ForemanRhCloud
5
5
  class Engine < ::Rails::Engine
6
6
  engine_name 'foreman_rh_cloud'
7
7
 
8
- initializer 'foreman_rh_cloud.load_default_settings', :before => :load_config_initializers do
9
- require_dependency File.expand_path('../../app/models/setting/rh_cloud.rb', __dir__)
10
- end
11
-
12
8
  config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
13
9
  config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
14
10
  config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
@@ -26,7 +22,7 @@ module ForemanRhCloud
26
22
 
27
23
  initializer 'foreman_rh_cloud.register_plugin', :before => :finisher_hook do |_app|
28
24
  Foreman::Plugin.register :foreman_rh_cloud do
29
- requires_foreman '>= 1.20'
25
+ requires_foreman '> 1.24'
30
26
 
31
27
  # Add permissions
32
28
  security_block :foreman_rh_cloud do
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '0.9.5'.freeze
2
+ VERSION = '2.0.4'.freeze
3
3
  end
@@ -4,14 +4,14 @@
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "lint": "./node_modules/.bin/eslint -c .eslintrc webpack/",
8
- "test": "node node_modules/.bin/jest --no-cache",
9
- "test:watch": "node node_modules/.bin/jest --watchAll",
10
- "test:current": "node node_modules/.bin/jest --watch",
11
- "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
12
- "storybook": "start-storybook -p 6006",
13
- "storybook:build": "node --max_old_space_size=2048 ./node_modules/.bin/build-storybook --config-dir .storybook --output-dir .storybook-dist",
14
- "storybook:deploy": "surge --project .storybook-dist"
7
+ "lint": "tfm-lint --plugin -d /webpack",
8
+ "test": "tfm-test --plugin",
9
+ "test:watch": "tfm-test --plugin --watchAll",
10
+ "test:current": "tfm-test --plugin --watch",
11
+ "publish-coverage": "tfm-publish-coverage",
12
+ "stories": "tfm-stories --plugin",
13
+ "stories:build": "tfm-build-stories --plugin",
14
+ "stories:deploy": "surge --project .storybook-dist"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -20,106 +20,26 @@
20
20
  "bugs": {
21
21
  "url": "http://projects.theforeman.org/projects/foreman_rh_cloud/issues"
22
22
  },
23
- "optionalDependencies": {
24
- "babel-plugin-module-resolver": "^3.2.0"
23
+ "peerDependencies": {
24
+ "@theforeman/vendor": ">= 4.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@storybook/addon-actions": "^5.0.1",
28
- "@storybook/addon-knobs": "^5.0.1",
29
- "@storybook/react": "^5.0.1",
30
- "babel-cli": "^6.10.1",
31
- "babel-core": "^6.26.3",
32
- "babel-eslint": "^8.2.3",
33
- "babel-jest": "^23.6.0",
34
- "babel-loader": "^7.1.1",
35
- "babel-plugin-dynamic-import-node": "^2.0.0",
36
- "babel-plugin-lodash": "^3.3.4",
37
- "babel-plugin-syntax-dynamic-import": "^6.18.0",
38
- "babel-plugin-transform-class-properties": "^6.24.1",
39
- "babel-plugin-transform-object-assign": "^6.8.0",
40
- "babel-plugin-transform-object-rest-spread": "^6.8.0",
41
- "babel-preset-env": "^1.7.0",
42
- "babel-preset-react": "^6.5.0",
43
- "coveralls": "^3.0.0",
44
- "enzyme": "^3.4.0",
45
- "enzyme-adapter-react-16": "^1.4.0",
46
- "enzyme-to-json": "^3.2.1",
47
- "eslint": "^4.10.0",
48
- "eslint-import-resolver-babel-module": "^4.0.0",
49
- "eslint-plugin-patternfly-react": "0.2.0",
50
- "identity-obj-proxy": "^3.0.0",
51
- "jed": "^1.1.1",
52
- "jest-cli": "^23.6.0",
53
- "jest-prop-type-error": "^1.1.0",
54
- "node-sass": "^4.5.0",
55
- "patternfly": "^3.58.0",
27
+ "@babel/core": "^7.7.0",
28
+ "@theforeman/builder": "^4.0.2",
29
+ "@theforeman/stories": "^4.0.2",
30
+ "@theforeman/test": "^4.0.2",
31
+ "@theforeman/vendor-dev": "^4.0.2",
32
+ "@theforeman/eslint-plugin-foreman": "^4.0.2",
33
+ "babel-eslint": "^10.0.0",
34
+ "eslint": "^6.7.2",
56
35
  "prettier": "^1.13.5",
57
36
  "raf": "^3.4.0",
58
- "react-redux-test-utils": "^0.1.1",
59
- "react-remarkable": "^1.1.3",
60
- "sass-loader": "^6.0.7",
61
37
  "stylelint": "^9.3.0",
62
38
  "stylelint-config-standard": "^18.0.0",
63
39
  "surge": "^0.20.3"
64
40
  },
65
41
  "dependencies": {
66
- "babel-polyfill": "^6.26.0",
67
- "classnames": "^2.2.5",
68
- "lodash": "^4.17.10",
69
- "patternfly-react": "^2.19.1",
70
- "prop-types": "^15.6.0",
71
- "react": "^16.4.0",
72
- "react-dom": "^16.4.0",
73
- "react-intl": "^2.8.0",
74
- "react-redux": "^5.0.6",
75
- "redux": "^3.6.0",
76
- "redux-thunk": "^2.2.0",
77
- "reselect": "^3.0.1",
78
- "seamless-immutable": "^7.1.2",
79
- "urijs": "^1.18.10",
80
- "uuid": "^3.0.1"
81
- },
82
- "jest": {
83
- "automock": true,
84
- "verbose": true,
85
- "testMatch": [
86
- "**/*.test.js"
87
- ],
88
- "testURL": "http://localhost/",
89
- "collectCoverage": true,
90
- "collectCoverageFrom": [
91
- "webpack/**/*.js",
92
- "!webpack/index.js",
93
- "!webpack/test_setup.js",
94
- "!webpack/**/bundle*",
95
- "!webpack/stories/**",
96
- "!webpack/**/*stories.js"
97
- ],
98
- "coverageReporters": [
99
- "lcov"
100
- ],
101
- "unmockedModulePathPatterns": [
102
- "webpack/",
103
- "react",
104
- "node_modules/"
105
- ],
106
- "moduleNameMapper": {
107
- "^.+\\.(png|gif|css|scss)$": "identity-obj-proxy"
108
- },
109
- "globals": {
110
- "__testing__": true
111
- },
112
- "transform": {
113
- "^.+\\.js$": "babel-jest"
114
- },
115
- "moduleDirectories": [
116
- "node_modules",
117
- "webpack"
118
- ],
119
- "setupFiles": [
120
- "raf/polyfill",
121
- "jest-prop-type-error",
122
- "./webpack/test_setup.js"
123
- ]
42
+ "jed": "^1.1.1",
43
+ "react-intl": "^2.8.0"
124
44
  }
125
45
  }
@@ -14,17 +14,12 @@ class AccountsControllerTest < ActionController::TestCase
14
14
  upload_label = ForemanInventoryUpload::Async::UploadReportJob.output_label(test_org.id)
15
15
  upload_output = ForemanInventoryUpload::Async::ProgressOutput.register(upload_label)
16
16
  upload_output.status = 'upload_status_test'
17
- FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :value => true)
18
- assert_equal true, Setting[:allow_auto_inventory_upload]
19
17
 
20
18
  get :index, session: set_session_user
21
19
 
22
20
  assert_response :success
23
- actual = JSON.parse(response.body)
24
- actual_account_statuses = actual['accounts'][test_org.id.to_s]
25
- assert_equal 'generate_status_test', actual_account_statuses['generate_report_status']
26
- assert_equal 'upload_status_test', actual_account_statuses['upload_report_status']
27
-
28
- assert_equal true, actual['autoUploadEnabled']
21
+ actual = JSON.parse(response.body)['accounts'][test_org.id.to_s]
22
+ assert_equal 'generate_status_test', actual['generate_report_status']
23
+ assert_equal 'upload_status_test', actual['upload_report_status']
29
24
  end
30
25
  end
@@ -18,17 +18,4 @@ class UploadsControllerTest < ActionController::TestCase
18
18
  actual = JSON.parse(response.body)
19
19
  assert_equal 'test output', actual['output']
20
20
  end
21
-
22
- test 'should update allow_auto_inventory_upload setting' do
23
- FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => false)
24
-
25
- assert_equal false, Setting[:allow_auto_inventory_upload]
26
-
27
- post :auto_upload, params: { value: true }, session: set_session_user
28
-
29
- assert_response :success
30
- actual = JSON.parse(response.body)
31
- assert_equal true, actual['autoUploadEnabled']
32
- assert_equal true, Setting[:allow_auto_inventory_upload]
33
- end
34
21
  end