1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-06-26 02:30:22 +02:00

gem: allow config to contain users without any hosts

This commit is contained in:
cn
2022-09-20 19:30:02 +02:00
parent d066b3ecee
commit 3a5b1bcb27
3 changed files with 19 additions and 1 deletions

View File

@ -15,6 +15,9 @@ describe Dyndnsd::Daemon do
'test' => {
'password' => 'secret',
'hosts' => ['foo.example.org', 'bar.example.org']
},
'test2' => {
'password' => 'ihavenohosts'
}
}
}
@ -99,6 +102,14 @@ describe Dyndnsd::Daemon do
expect(last_response.body).to eq('notfqdn')
end
it 'rejects request if user does not own any hostnames' do
authorize 'test2', 'ihavenohosts'
get '/nic/update?hostname=doesnotexisthost.example.org'
expect(last_response).to be_ok
expect(last_response.body).to eq('nohost')
end
it 'rejects request if user does not own one hostname' do
authorize 'test', 'secret'