gem: allow config to contain users without any hosts

This commit is contained in:
cn committed 2022-09-20 19:31:46 +02:00
1 parent d066b3ecee
commit 3a5b1bcb27
3 files changed
+19 -1

No files matched your search

+11
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'