mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 15:26:03 +01:00
Fix failing tests caused by r24087 (#29664).
git-svn-id: https://svn.redmine.org/redmine/trunk@24088 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -401,9 +401,11 @@ class MyControllerTest < Redmine::ControllerTest
|
||||
def test_my_account_should_toggle_webhook_link_with_setting
|
||||
User.find(2).roles.first.add_permission!(:use_webhooks)
|
||||
|
||||
get :account
|
||||
assert_response :success
|
||||
assert_select 'a.icon-webhook', 1
|
||||
with_settings webhooks_enabled: '1' do
|
||||
get :account
|
||||
assert_response :success
|
||||
assert_select 'a.icon-webhook', 1
|
||||
end
|
||||
|
||||
with_settings webhooks_enabled: '0' do
|
||||
get :account
|
||||
|
||||
@@ -12,6 +12,11 @@ class WebhooksControllerTest < Redmine::ControllerTest
|
||||
@hook = create_hook
|
||||
@other_hook = create_hook user: User.find_by_login('admin'), url: 'https://example.com/other/hook'
|
||||
@request.session[:user_id] = @dlopper.id
|
||||
@original_webhooks_setting = Setting.webhooks_enabled = '1'
|
||||
end
|
||||
|
||||
teardown do
|
||||
Setting.webhooks_enabled = @original_webhooks_setting
|
||||
end
|
||||
|
||||
test "should require login" do
|
||||
|
||||
@@ -153,23 +153,28 @@ class WebhookTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "schedule should enqueue jobs for hooks" do
|
||||
hook = create_hook
|
||||
assert_enqueued_jobs 1 do
|
||||
assert_enqueued_with(job: WebhookJob) do
|
||||
Webhook.trigger('issue.created', @issue)
|
||||
with_settings webhooks_enabled: '1' do
|
||||
hook = create_hook
|
||||
assert_enqueued_jobs 1 do
|
||||
assert_enqueued_with(job: WebhookJob) do
|
||||
Webhook.trigger('issue.created', @issue)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test "should not enqueue job for inactive hook" do
|
||||
hook = create_hook active: false
|
||||
assert_no_enqueued_jobs do
|
||||
Webhook.trigger('issue.created', @issue)
|
||||
with_settings webhooks_enabled: '1' do
|
||||
hook = create_hook active: false
|
||||
assert_no_enqueued_jobs do
|
||||
Webhook.trigger('issue.created', @issue)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test "enabled? should follow setting flag" do
|
||||
assert Webhook.enabled?
|
||||
# Disabled by default
|
||||
assert_not Webhook.enabled?
|
||||
|
||||
with_settings webhooks_enabled: '0' do
|
||||
assert_not Webhook.enabled?
|
||||
|
||||
Reference in New Issue
Block a user