mirror of
https://github.com/redmine/redmine.git
synced 2025-11-10 07:16: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
|
def test_my_account_should_toggle_webhook_link_with_setting
|
||||||
User.find(2).roles.first.add_permission!(:use_webhooks)
|
User.find(2).roles.first.add_permission!(:use_webhooks)
|
||||||
|
|
||||||
|
with_settings webhooks_enabled: '1' do
|
||||||
get :account
|
get :account
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_select 'a.icon-webhook', 1
|
assert_select 'a.icon-webhook', 1
|
||||||
|
end
|
||||||
|
|
||||||
with_settings webhooks_enabled: '0' do
|
with_settings webhooks_enabled: '0' do
|
||||||
get :account
|
get :account
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ class WebhooksControllerTest < Redmine::ControllerTest
|
|||||||
@hook = create_hook
|
@hook = create_hook
|
||||||
@other_hook = create_hook user: User.find_by_login('admin'), url: 'https://example.com/other/hook'
|
@other_hook = create_hook user: User.find_by_login('admin'), url: 'https://example.com/other/hook'
|
||||||
@request.session[:user_id] = @dlopper.id
|
@request.session[:user_id] = @dlopper.id
|
||||||
|
@original_webhooks_setting = Setting.webhooks_enabled = '1'
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.webhooks_enabled = @original_webhooks_setting
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should require login" do
|
test "should require login" do
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ class WebhookTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
test "schedule should enqueue jobs for hooks" do
|
test "schedule should enqueue jobs for hooks" do
|
||||||
|
with_settings webhooks_enabled: '1' do
|
||||||
hook = create_hook
|
hook = create_hook
|
||||||
assert_enqueued_jobs 1 do
|
assert_enqueued_jobs 1 do
|
||||||
assert_enqueued_with(job: WebhookJob) do
|
assert_enqueued_with(job: WebhookJob) do
|
||||||
@@ -160,16 +161,20 @@ class WebhookTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test "should not enqueue job for inactive hook" do
|
test "should not enqueue job for inactive hook" do
|
||||||
|
with_settings webhooks_enabled: '1' do
|
||||||
hook = create_hook active: false
|
hook = create_hook active: false
|
||||||
assert_no_enqueued_jobs do
|
assert_no_enqueued_jobs do
|
||||||
Webhook.trigger('issue.created', @issue)
|
Webhook.trigger('issue.created', @issue)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test "enabled? should follow setting flag" do
|
test "enabled? should follow setting flag" do
|
||||||
assert Webhook.enabled?
|
# Disabled by default
|
||||||
|
assert_not Webhook.enabled?
|
||||||
|
|
||||||
with_settings webhooks_enabled: '0' do
|
with_settings webhooks_enabled: '0' do
|
||||||
assert_not Webhook.enabled?
|
assert_not Webhook.enabled?
|
||||||
|
|||||||
Reference in New Issue
Block a user