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

daemon: add host offlining by deleting the associated DNS records

This commit is contained in:
cn
2018-02-23 16:37:10 +01:00
parent 8d4e96a1dd
commit 147071da9e
5 changed files with 48 additions and 6 deletions

View File

@ -167,6 +167,34 @@ describe Dyndnsd::Daemon do
expect(last_response.body).to eq("nochg 2001:db8::1\ngood 2001:db8::1")
end
it 'offlines a host' do
authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
expect(last_response).to be_ok
expect(last_response.body).to eq('good 1.2.3.4')
get '/nic/update?hostname=foo.example.org&offline=YES'
expect(last_response).to be_ok
expect(last_response.body).to eq('good ')
get '/nic/update?hostname=foo.example.org&offline=YES'
expect(last_response).to be_ok
expect(last_response.body).to eq('nochg ')
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
expect(last_response).to be_ok
expect(last_response.body).to eq('good 1.2.3.4')
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4&offline=YES'
expect(last_response).to be_ok
expect(last_response.body).to eq('good ')
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4&offline=YES'
expect(last_response).to be_ok
expect(last_response.body).to eq('nochg ')
end
it 'uses clients remote IP address if myip not specified' do
authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org'