mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
36 lines
1.2 KiB
Ruby
36 lines
1.2 KiB
Ruby
# Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe 'Monitoring', type: :request do
|
|
let(:token) { Setting.get('monitoring_token') }
|
|
|
|
describe 'Health check API not working when logged in as non-admin #5029' do
|
|
let(:admin) { create(:admin) }
|
|
let(:customer) { create(:customer) }
|
|
|
|
context 'when admin', authenticated_as: :admin do
|
|
it 'does return results via token' do
|
|
get "/api/v1/monitoring/health_check?token=#{token}", as: :json
|
|
expect(response).to have_http_status(:ok)
|
|
end
|
|
|
|
it 'does return results without token' do
|
|
get '/api/v1/monitoring/health_check', as: :json
|
|
expect(response).to have_http_status(:ok)
|
|
end
|
|
end
|
|
|
|
context 'when customer', authenticated_as: :customer do
|
|
it 'does return results via token' do
|
|
get "/api/v1/monitoring/health_check?token=#{token}", as: :json
|
|
expect(response).to have_http_status(:ok)
|
|
end
|
|
|
|
it 'does not return results without token' do
|
|
get '/api/v1/monitoring/health_check', as: :json
|
|
expect(response).to have_http_status(:forbidden)
|
|
end
|
|
end
|
|
end
|
|
end
|