mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
Fix the API key authentication for Owntracks points
This commit is contained in:
parent
b76f75a494
commit
bc8647f5e4
3 changed files with 5 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ class Api::V1::Owntracks::PointsController < ApplicationController
|
|||
before_action :authenticate_api_key
|
||||
|
||||
def create
|
||||
Owntracks::PointCreatingJob.perform_later(point_params, current_user.id)
|
||||
Owntracks::PointCreatingJob.perform_later(point_params, current_api_user.id)
|
||||
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ RSpec.describe 'Api::V1::Owntracks::Points', type: :request do
|
|||
|
||||
context 'with invalid api key' do
|
||||
it 'returns http unauthorized' do
|
||||
post api_v1_points_path, params: params
|
||||
post api_v1_owntracks_points_path, params: params
|
||||
|
||||
expect(response).to have_http_status(:unauthorized)
|
||||
end
|
||||
|
|
@ -20,14 +20,14 @@ RSpec.describe 'Api::V1::Owntracks::Points', type: :request do
|
|||
|
||||
context 'with valid api key' do
|
||||
it 'returns http success' do
|
||||
post api_v1_points_path(api_key: user.api_key), params: params
|
||||
post api_v1_owntracks_points_path(api_key: user.api_key), params: params
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'enqueues a job' do
|
||||
expect do
|
||||
post api_v1_points_path(api_key: user.api_key), params: params
|
||||
post api_v1_owntracks_points_path(api_key: user.api_key), params: params
|
||||
end.to have_enqueued_job(Owntracks::PointCreatingJob)
|
||||
end
|
||||
end
|
||||
|
|
@ -180,7 +180,7 @@ paths:
|
|||
lat: 52.502397
|
||||
lon: 13.356718
|
||||
tid: Swagger
|
||||
tst: 1716638268
|
||||
tst: 1716638918
|
||||
servers:
|
||||
- url: http://{defaultHost}
|
||||
variables:
|
||||
|
|
|
|||
Loading…
Reference in a new issue