[add] added maximum client and demo client protection
- default demo clients can no longer be modified/deleted when in demo mode - increased default demo reset to 60 minutes
This commit is contained in:
@@ -160,6 +160,20 @@ RSpec.describe 'Clients', type: :request do
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when sending a valid request to add another client above the MAX_CLIENTS limit' do
|
||||
before do
|
||||
clients_to_create = RynDNS::Application::MAX_CLIENTS - Client.count
|
||||
create_list(:client, clients_to_create)
|
||||
post '/admin/client', params: { name: 'extra_user' }, headers: api_key_header(admin_client)
|
||||
end
|
||||
|
||||
it 'does not add another client and returns status code 429' do
|
||||
expect(Client.count).to eq RynDNS::Application::MAX_CLIENTS
|
||||
expect(response.body).to be_empty
|
||||
expect(response).to have_http_status(429)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'PUT /admin/client' do
|
||||
|
||||
Reference in New Issue
Block a user