foreman_webhooks 5.0.2 → 5.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0e6639b74aa9598f8a7961d48dd5c2bf81714bb6f6111e9f9bbb65a2393a4d2
4
- data.tar.gz: fbe6d793527bf76fd9c3d73e357c7a4da87e3a77b1a8636652569e47955ef928
3
+ metadata.gz: 25c2a83a7c2015b3e3d0b184beb4ce534c27bbe90cbd9fb301d138d7e183e5c5
4
+ data.tar.gz: b0a16fa70ffde8610190a3c0718046d4c0dedf25633a21bfb5ba341efde778ce
5
5
  SHA512:
6
- metadata.gz: 7de4a54540a300b0d0f5de39b79275074c403f4d74ccf1a5d53fa22f77ae6bfba2788f26824b8642608da39ef09e4bd99be88fdf7a615e527cb1070066730631
7
- data.tar.gz: 752cb5d63594e68e313b9a91a4fce2955a0fce47ad51a25351c0f9c43df4104ad2a456dd1e9651b2d7b51a65daef196c1f39ddf726e7b701ad146455238b00d0
6
+ metadata.gz: ce79fa03fd4dccce1a495510bbeded83546b3330dde622fa5b4d03ef61d8eb1f0d752c72257ab36f6fcc28cf7b1c8164fb500c764914d6f06d0712ce756c38cb
7
+ data.tar.gz: 5a949f01600d04a667e710107e2275f58e104ced6a5317c90a21285851cb7a9e39a85770cdd34b9c6e4bed029fe9d705b4bfd31e1cd9680b1eceac1456bb6488
@@ -76,8 +76,11 @@ module Api
76
76
  param :id, :identifier, required: true
77
77
  param_group :webhook_template_clone, as: :create
78
78
  def clone
79
- @webhook_template = @webhook_template.dup
79
+ original = @webhook_template
80
+ @webhook_template = original.dup
81
+ @webhook_template.cloned_from = original
80
82
  @webhook_template.name = params[:webhook_template][:name]
83
+ @webhook_template.locked = false
81
84
  process_response @webhook_template.save
82
85
  end
83
86
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanWebhooks
4
- VERSION = "5.0.2"
4
+ VERSION = "5.0.3"
5
5
  end
@@ -168,13 +168,16 @@ class Api::V2::WebhookTemplatesControllerTest < ActionController::TestCase
168
168
  end
169
169
 
170
170
  test 'should clone template' do
171
- original_webhook_template = FactoryBot.create(:webhook_template)
171
+ original_webhook_template = FactoryBot.create(:webhook_template, locked: true)
172
172
  post :clone, params: { id: original_webhook_template.to_param,
173
173
  webhook_template: { name: 'MyClone' } }
174
174
  assert_response :success
175
175
  template = ActiveSupport::JSON.decode(@response.body)
176
176
  assert_equal(template['name'], 'MyClone')
177
177
  assert_equal(template['template'], original_webhook_template.template)
178
+ refute_equal(template['id'], original_webhook_template.id, 'Clone ID different from original')
179
+ assert_equal(template['cloned_from_id'], original_webhook_template.id)
180
+ assert_equal(template['locked'], false)
178
181
  refute_equal(template['id'], original_webhook_template.id)
179
182
  end
180
183
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Goebel
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  - !ruby/object:Gem::Version
273
273
  version: '0'
274
274
  requirements: []
275
- rubygems_version: 4.0.3
275
+ rubygems_version: 4.0.6
276
276
  specification_version: 4
277
277
  summary: Configure webhooks for Foreman.
278
278
  test_files: