1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2024-12-22 00:54:22 +01:00

Add coverage of IPv6 addresses in tests

This commit is contained in:
cn 2016-11-30 21:24:56 +01:00
parent cfce5be361
commit a9083e916e

View File

@ -55,9 +55,14 @@ describe Dyndnsd::Daemon do
it 'supports multiple hostnames in request' do it 'supports multiple hostnames in request' do
authorize 'test', 'secret' authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=1.2.3.4' get '/nic/update?hostname=foo.example.org,bar.example.org&myip=1.2.3.4'
last_response.should be_ok last_response.should be_ok
last_response.body.should == "good 1.2.3.4\ngood 1.2.3.4" last_response.body.should == "good 1.2.3.4\ngood 1.2.3.4"
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=2001:db8::1'
last_response.should be_ok
last_response.body.should == "good 2001:db8::1\ngood 2001:db8::1"
end end
it 'rejects request if one hostname is invalid' do it 'rejects request if one hostname is invalid' do
@ -99,7 +104,7 @@ describe Dyndnsd::Daemon do
last_response.body.should == 'nohost' last_response.body.should == 'nohost'
end end
it 'updates a host on IPv4 change' do it 'updates a host on IP change' do
authorize 'test', 'secret' authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4' get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
@ -108,9 +113,16 @@ describe Dyndnsd::Daemon do
get '/nic/update?hostname=foo.example.org&myip=1.2.3.40' get '/nic/update?hostname=foo.example.org&myip=1.2.3.40'
last_response.should be_ok last_response.should be_ok
last_response.body.should == 'good 1.2.3.40' last_response.body.should == 'good 1.2.3.40'
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
last_response.should be_ok
get '/nic/update?hostname=foo.example.org&myip=2001:db8::10'
last_response.should be_ok
last_response.body.should == 'good 2001:db8::10'
end end
it 'returns IPv4 no change' do it 'returns IP no change' do
authorize 'test', 'secret' authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4' get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
@ -119,9 +131,16 @@ describe Dyndnsd::Daemon do
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4' get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
last_response.should be_ok last_response.should be_ok
last_response.body.should == 'nochg 1.2.3.4' last_response.body.should == 'nochg 1.2.3.4'
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
last_response.should be_ok
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
last_response.should be_ok
last_response.body.should == 'nochg 2001:db8::1'
end end
it 'outputs IPv4 status per hostname' do it 'outputs IP status per hostname' do
authorize 'test', 'secret' authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4' get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
@ -131,9 +150,17 @@ describe Dyndnsd::Daemon do
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=1.2.3.4' get '/nic/update?hostname=foo.example.org,bar.example.org&myip=1.2.3.4'
last_response.should be_ok last_response.should be_ok
last_response.body.should == "nochg 1.2.3.4\ngood 1.2.3.4" last_response.body.should == "nochg 1.2.3.4\ngood 1.2.3.4"
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
last_response.should be_ok
last_response.body.should == 'good 2001:db8::1'
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=2001:db8::1'
last_response.should be_ok
last_response.body.should == "nochg 2001:db8::1\ngood 2001:db8::1"
end end
it 'uses clients remote IPv4 address if myip not specified' do it 'uses clients remote IP address if myip not specified' do
authorize 'test', 'secret' authorize 'test', 'secret'
get '/nic/update?hostname=foo.example.org' get '/nic/update?hostname=foo.example.org'
last_response.should be_ok last_response.should be_ok