2021-06-28 09:50:37 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
module OpenApi; end
|
|
|
|
|
|
|
|
class OpenApi::BookableMachinesTest < ActionDispatch::IntegrationTest
|
|
|
|
def setup
|
|
|
|
@token = OpenAPI::Client.find_by(name: 'minitest').token
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'list all bookable machines without user_id' do
|
|
|
|
get '/open_api/v1/bookable_machines', headers: open_api_headers(@token)
|
|
|
|
assert_response :internal_server_error
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'list all bookable machines' do
|
|
|
|
get '/open_api/v1/bookable_machines?user_id=3', headers: open_api_headers(@token)
|
|
|
|
assert_response :success
|
|
|
|
end
|
2022-12-07 10:15:15 +01:00
|
|
|
|
|
|
|
test 'check if a given machine is bookable by user' do
|
|
|
|
get '/open_api/v1/bookable_machines?user_id=3&machine_id=1', headers: open_api_headers(@token)
|
|
|
|
assert_response :success
|
|
|
|
end
|
2021-06-28 09:50:37 +02:00
|
|
|
end
|