[CW-53] feat: allow downloading heatmap report (#6683)

* feat: add control header slot

* feat: add download API call

* feat: add conversation traffic template

* feat: allow downloading heatmap content

* feat: wire up download

* fix: grid layout for mobile

* chore: revert formatting

* revert: en.yml file

* feat: add conversation traffic text

* feat: disable rule for map block

* test: conversation traffic

* fix: timezone offset

* feat: download report in UTC

* feat: add UTC warning

* chore: revert formatting

* feat: add traffic text

* chore: fix whitespace change
This commit is contained in:
Shivam Mishra
2023-03-20 15:46:29 +05:30
committed by GitHub
parent 4f936aada5
commit e5134c9ef5
10 changed files with 192 additions and 30 deletions

View File

@@ -363,4 +363,39 @@ RSpec.describe 'Reports API', type: :request do
end
end
end
describe 'GET /api/v2/accounts/:account_id/reports/conversation_traffic' do
context 'when it is an unauthenticated user' do
it 'returns unauthorized' do
get "/api/v2/accounts/#{account.id}/reports/conversation_traffic.csv"
expect(response).to have_http_status(:unauthorized)
end
end
context 'when it is an authenticated user' do
let(:params) do
super().merge(
since: 7.days.ago.to_i.to_s,
until: date_timestamp.to_s
)
end
it 'returns unauthorized' do
get "/api/v2/accounts/#{account.id}/reports/conversation_traffic.csv",
params: params,
headers: agent.create_new_auth_token
expect(response).to have_http_status(:unauthorized)
end
it 'returns values' do
get "/api/v2/accounts/#{account.id}/reports/conversation_traffic.csv",
params: params,
headers: admin.create_new_auth_token
expect(response).to have_http_status(:success)
end
end
end
end