mirror of
https://github.com/mastodon/mastodon
synced 2024-11-27 14:28:24 +09:00
Fix SQL error in admin measures API (#30753)
This commit is contained in:
parent
d97fcd0cbb
commit
58ace2e45e
@ -18,7 +18,7 @@ module Admin::Metrics::Measure::QueryHelper
|
|||||||
def generated_series_days
|
def generated_series_days
|
||||||
Arel.sql(
|
Arel.sql(
|
||||||
<<~SQL.squish
|
<<~SQL.squish
|
||||||
SELECT generate_series(timestamp :start_at, :end_at, '1 day')::date AS period
|
SELECT generate_series(:start_at::timestamp, :end_at::timestamp, '1 day')::date AS period
|
||||||
SQL
|
SQL
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -7,11 +7,28 @@ describe 'Admin Measures' do
|
|||||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||||
let(:account) { Fabricate(:account) }
|
let(:account) { Fabricate(:account) }
|
||||||
|
let(:params) do
|
||||||
|
{
|
||||||
|
keys: %w(instance_accounts instance_follows instance_followers),
|
||||||
|
instance_accounts: {
|
||||||
|
domain: 'mastodon.social',
|
||||||
|
include_subdomains: true,
|
||||||
|
},
|
||||||
|
instance_follows: {
|
||||||
|
domain: 'mastodon.social',
|
||||||
|
include_subdomains: true,
|
||||||
|
},
|
||||||
|
instance_followers: {
|
||||||
|
domain: 'mastodon.social',
|
||||||
|
include_subdomains: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
describe 'GET /api/v1/admin/measures' do
|
describe 'GET /api/v1/admin/measures' do
|
||||||
context 'when not authorized' do
|
context 'when not authorized' do
|
||||||
it 'returns http forbidden' do
|
it 'returns http forbidden' do
|
||||||
post '/api/v1/admin/measures', params: { account_id: account.id, limit: 2 }
|
post '/api/v1/admin/measures', params: params
|
||||||
|
|
||||||
expect(response)
|
expect(response)
|
||||||
.to have_http_status(403)
|
.to have_http_status(403)
|
||||||
@ -22,7 +39,7 @@ describe 'Admin Measures' do
|
|||||||
let(:scopes) { 'admin:read' }
|
let(:scopes) { 'admin:read' }
|
||||||
|
|
||||||
it 'returns http success and status json' do
|
it 'returns http success and status json' do
|
||||||
post '/api/v1/admin/measures', params: { account_id: account.id, limit: 2 }, headers: headers
|
post '/api/v1/admin/measures', params: params, headers: headers
|
||||||
|
|
||||||
expect(response)
|
expect(response)
|
||||||
.to have_http_status(200)
|
.to have_http_status(200)
|
||||||
|
Loading…
Reference in New Issue
Block a user