mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31: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
|
before_action :authenticate_api_key
|
||||||
|
|
||||||
def create
|
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
|
render json: {}, status: :ok
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ RSpec.describe 'Api::V1::Owntracks::Points', type: :request do
|
||||||
|
|
||||||
context 'with invalid api key' do
|
context 'with invalid api key' do
|
||||||
it 'returns http unauthorized' 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)
|
expect(response).to have_http_status(:unauthorized)
|
||||||
end
|
end
|
||||||
|
|
@ -20,14 +20,14 @@ RSpec.describe 'Api::V1::Owntracks::Points', type: :request do
|
||||||
|
|
||||||
context 'with valid api key' do
|
context 'with valid api key' do
|
||||||
it 'returns http success' 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)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'enqueues a job' do
|
it 'enqueues a job' do
|
||||||
expect 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.to have_enqueued_job(Owntracks::PointCreatingJob)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -180,7 +180,7 @@ paths:
|
||||||
lat: 52.502397
|
lat: 52.502397
|
||||||
lon: 13.356718
|
lon: 13.356718
|
||||||
tid: Swagger
|
tid: Swagger
|
||||||
tst: 1716638268
|
tst: 1716638918
|
||||||
servers:
|
servers:
|
||||||
- url: http://{defaultHost}
|
- url: http://{defaultHost}
|
||||||
variables:
|
variables:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue