net-ping 1.7.1-universal-mingw32 → 1.7.2-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,210 +1,230 @@
1
- #################################################################################
2
- # test_net_ping_http.rb
3
- #
4
- # Test case for the Net::PingHTTP class. This should be run via the 'test' or
5
- # 'test:http' Rake task.
6
- #################################################################################
7
- require 'test-unit'
8
- require 'fakeweb'
9
- require 'net/ping/http'
10
-
11
- class TC_Net_Ping_HTTP < Test::Unit::TestCase
12
- def setup
13
- ENV['http_proxy'] = ENV['https_proxy'] = ENV['no_proxy'] = nil
14
- @uri = 'http://www.google.com/index.html'
15
- @uri_https = 'https://encrypted.google.com'
16
- @proxy = 'http://username:password@proxymoxie:3128'
17
- FakeWeb.allow_net_connect = false
18
-
19
- FakeWeb.register_uri(:get, @uri, :body => "PONG")
20
- FakeWeb.register_uri(:head, @uri, :body => "PONG")
21
- FakeWeb.register_uri(:head, @uri_https, :body => "PONG")
22
- FakeWeb.register_uri(:get, @uri_https, :body => "PONG")
23
- FakeWeb.register_uri(:head, "http://jigsaw.w3.org/HTTP/300/302.html",
24
- :body => "PONG",
25
- :location => "#{@uri}",
26
- :status => ["302", "Found"])
27
-
28
- FakeWeb.register_uri(:any, 'http://www.blabfoobarurghxxxx.com', :exception => SocketError)
29
-
30
- @http = Net::Ping::HTTP.new(@uri, 80, 30)
31
- @bad = Net::Ping::HTTP.new('http://www.blabfoobarurghxxxx.com') # One hopes not
32
- end
33
-
34
- test 'ping basic functionality' do
35
- assert_respond_to(@http, :ping)
36
- assert_nothing_raised{ @http.ping }
37
- end
38
-
39
- test 'ping returns a boolean value' do
40
- assert_boolean(@http.ping?)
41
- assert_boolean(@bad.ping?)
42
- end
43
-
44
- test 'ping? is an alias for ping' do
45
- assert_alias_method(@http, :ping?, :ping)
46
- end
47
-
48
- test 'pingecho is an alias for ping' do
49
- assert_alias_method(@http, :pingecho, :ping)
50
- end
51
-
52
- test 'ping should succeed for a valid website' do
53
- assert_true(@http.ping?)
54
- end
55
-
56
- test 'ping should fail for an invalid website' do
57
- assert_false(@bad.ping?)
58
- end
59
-
60
- test 'duration basic functionality' do
61
- assert_respond_to(@http, :duration)
62
- assert_nothing_raised{ @http.ping }
63
- end
64
-
65
- test 'duration returns a float value on a successful ping' do
66
- assert_true(@http.ping)
67
- assert_kind_of(Float, @http.duration)
68
- end
69
-
70
- test 'duration is nil on an unsuccessful ping' do
71
- assert_false(@bad.ping)
72
- assert_nil(@http.duration)
73
- end
74
-
75
- test 'host attribute basic functionality' do
76
- assert_respond_to(@http, :host)
77
- assert_respond_to(@http, :host=)
78
- assert_equal('http://www.google.com/index.html', @http.host)
79
- end
80
-
81
- test 'uri is an alias for host' do
82
- assert_alias_method(@http, :uri, :host)
83
- assert_alias_method(@http, :uri=, :host=)
84
- end
85
-
86
- test 'port attribute basic functionality' do
87
- assert_respond_to(@http, :port)
88
- assert_respond_to(@http, :port=)
89
- end
90
-
91
- test 'port attribute expected value' do
92
- assert_equal(80, @http.port)
93
- end
94
-
95
- test 'timeout attribute basic functionality' do
96
- assert_respond_to(@http, :timeout)
97
- assert_respond_to(@http, :timeout=)
98
- end
99
-
100
- test 'timeout attribute expected values' do
101
- assert_equal(30, @http.timeout)
102
- assert_equal(5, @bad.timeout)
103
- end
104
-
105
- test 'exception attribute basic functionality' do
106
- assert_respond_to(@http, :exception)
107
- assert_nil(@http.exception)
108
- end
109
-
110
- test 'exception attribute is nil if the ping is successful' do
111
- assert_true(@http.ping)
112
- assert_nil(@http.exception)
113
- end
114
-
115
- test 'exception attribute is not nil if the ping is unsuccessful' do
116
- assert_false(@bad.ping)
117
- assert_not_nil(@bad.exception)
118
- end
119
-
120
- test 'warning attribute basic functionality' do
121
- assert_respond_to(@http, :warning)
122
- assert_nil(@http.warning)
123
- end
124
-
125
- test 'user_agent accessor is defined' do
126
- assert_respond_to(@http, :user_agent)
127
- assert_respond_to(@http, :user_agent=)
128
- end
129
-
130
- test 'user_agent defaults to nil' do
131
- assert_nil(@http.user_agent)
132
- end
133
-
134
- test 'ping with user agent' do
135
- @http.user_agent = "KDDI-CA32"
136
- assert_true(@http.ping)
137
- end
138
-
139
- test 'redirect_limit accessor is defined' do
140
- assert_respond_to(@http, :redirect_limit)
141
- assert_respond_to(@http, :redirect_limit=)
142
- end
143
-
144
- test 'redirect_limit defaults to 5' do
145
- assert_equal(5, @http.redirect_limit)
146
- end
147
-
148
- test 'redirects succeed by default' do
149
- @http = Net::Ping::HTTP.new("http://jigsaw.w3.org/HTTP/300/302.html")
150
- assert_true(@http.ping)
151
- end
152
-
153
- test 'redirect fail if follow_redirect is set to false' do
154
- @http = Net::Ping::HTTP.new("http://jigsaw.w3.org/HTTP/300/302.html")
155
- @http.follow_redirect = false
156
- assert_false(@http.ping)
157
- end
158
-
159
- test 'ping with redirect limit set to zero fails' do
160
- @http = Net::Ping::HTTP.new("http://jigsaw.w3.org/HTTP/300/302.html")
161
- @http.redirect_limit = 0
162
- assert_false(@http.ping)
163
- assert_equal("Redirect limit exceeded", @http.exception)
164
- end
165
-
166
- test 'ping against https site defaults to port 443' do
167
- @http = Net::Ping::HTTP.new(@uri_https)
168
- assert_equal(443, @http.port)
169
- end
170
-
171
- test 'ping against https site works as expected' do
172
- @http = Net::Ping::HTTP.new(@uri_https)
173
- assert_true(@http.ping)
174
- end
175
-
176
- test 'ping with get option' do
177
- @http = Net::Ping::HTTP.new(@uri)
178
- @http.get_request = true
179
- assert_true(@http.ping)
180
- end
181
-
182
- test 'ping with http proxy' do
183
- ENV['http_proxy'] = "http://proxymoxie:3128"
184
- @http = Net::Ping::HTTP.new(@uri)
185
- @http.get_request = true
186
- assert_true(@http.ping)
187
- assert_true(@http.proxied)
188
- end
189
-
190
- test 'ping with https proxy' do
191
- ENV['https_proxy'] = "http://proxymoxie:3128"
192
- @http = Net::Ping::HTTP.new(@uri_https)
193
- @http.get_request = true
194
- assert_true(@http.ping)
195
- assert_true(@http.proxied)
196
- end
197
-
198
- test 'ping with no_proxy' do
199
- ENV['no_proxy'] = "google.com"
200
- @http = Net::Ping::HTTP.new(@uri)
201
- @http.get_request = true
202
- assert_true(@http.ping)
203
- assert_false(@http.proxied)
204
- end
205
-
206
- def teardown
207
- @uri = nil
208
- @http = nil
209
- end
210
- end
1
+ #################################################################################
2
+ # test_net_ping_http.rb
3
+ #
4
+ # Test case for the Net::PingHTTP class. This should be run via the 'test' or
5
+ # 'test:http' Rake task.
6
+ #################################################################################
7
+ require 'test-unit'
8
+ require 'fakeweb'
9
+ require 'net/ping/http'
10
+
11
+ class TC_Net_Ping_HTTP < Test::Unit::TestCase
12
+ def setup
13
+ ENV['http_proxy'] = ENV['https_proxy'] = ENV['no_proxy'] = nil
14
+ @uri = 'http://www.google.com/index.html'
15
+ @uri_https = 'https://encrypted.google.com'
16
+ @proxy = 'http://username:password@proxymoxie:3128'
17
+ FakeWeb.allow_net_connect = false
18
+
19
+ FakeWeb.register_uri(:get, @uri, :body => "PONG")
20
+ FakeWeb.register_uri(:head, @uri, :body => "PONG")
21
+ FakeWeb.register_uri(:head, @uri_https, :body => "PONG")
22
+ FakeWeb.register_uri(:get, @uri_https, :body => "PONG")
23
+ FakeWeb.register_uri(:head, "http://jigsaw.w3.org/HTTP/300/302.html",
24
+ :body => "PONG",
25
+ :location => "#{@uri}",
26
+ :status => ["302", "Found"])
27
+
28
+ FakeWeb.register_uri(:any, 'http://www.blabfoobarurghxxxx.com', :exception => SocketError)
29
+ FakeWeb.register_uri(:head, 'http://http502.com',
30
+ :body => "",
31
+ :status => ["502", "Bad Gateway"])
32
+
33
+ @http = Net::Ping::HTTP.new(@uri, 80, 30)
34
+ @bad = Net::Ping::HTTP.new('http://www.blabfoobarurghxxxx.com') # One hopes not
35
+ end
36
+
37
+ test 'ping basic functionality' do
38
+ assert_respond_to(@http, :ping)
39
+ assert_nothing_raised{ @http.ping }
40
+ end
41
+
42
+ test 'ping returns a boolean value' do
43
+ assert_boolean(@http.ping?)
44
+ assert_boolean(@bad.ping?)
45
+ end
46
+
47
+ test 'ping? is an alias for ping' do
48
+ assert_alias_method(@http, :ping?, :ping)
49
+ end
50
+
51
+ test 'pingecho is an alias for ping' do
52
+ assert_alias_method(@http, :pingecho, :ping)
53
+ end
54
+
55
+ test 'ping should succeed for a valid website' do
56
+ assert_true(@http.ping?)
57
+ end
58
+
59
+ test 'ping should fail for an invalid website' do
60
+ assert_false(@bad.ping?)
61
+ end
62
+
63
+ test 'duration basic functionality' do
64
+ assert_respond_to(@http, :duration)
65
+ assert_nothing_raised{ @http.ping }
66
+ end
67
+
68
+ test 'duration returns a float value on a successful ping' do
69
+ assert_true(@http.ping)
70
+ assert_kind_of(Float, @http.duration)
71
+ end
72
+
73
+ test 'duration is nil on an unsuccessful ping' do
74
+ assert_false(@bad.ping)
75
+ assert_nil(@http.duration)
76
+ end
77
+
78
+ test 'host attribute basic functionality' do
79
+ assert_respond_to(@http, :host)
80
+ assert_respond_to(@http, :host=)
81
+ assert_equal('http://www.google.com/index.html', @http.host)
82
+ end
83
+
84
+ test 'uri is an alias for host' do
85
+ assert_alias_method(@http, :uri, :host)
86
+ assert_alias_method(@http, :uri=, :host=)
87
+ end
88
+
89
+ test 'port attribute basic functionality' do
90
+ assert_respond_to(@http, :port)
91
+ assert_respond_to(@http, :port=)
92
+ end
93
+
94
+ test 'port attribute expected value' do
95
+ assert_equal(80, @http.port)
96
+ end
97
+
98
+ test 'timeout attribute basic functionality' do
99
+ assert_respond_to(@http, :timeout)
100
+ assert_respond_to(@http, :timeout=)
101
+ end
102
+
103
+ test 'timeout attribute expected values' do
104
+ assert_equal(30, @http.timeout)
105
+ assert_equal(5, @bad.timeout)
106
+ end
107
+
108
+ test 'exception attribute basic functionality' do
109
+ assert_respond_to(@http, :exception)
110
+ assert_nil(@http.exception)
111
+ end
112
+
113
+ test 'exception attribute is nil if the ping is successful' do
114
+ assert_true(@http.ping)
115
+ assert_nil(@http.exception)
116
+ end
117
+
118
+ test 'exception attribute is not nil if the ping is unsuccessful' do
119
+ assert_false(@bad.ping)
120
+ assert_not_nil(@bad.exception)
121
+ end
122
+
123
+ test 'warning attribute basic functionality' do
124
+ assert_respond_to(@http, :warning)
125
+ assert_nil(@http.warning)
126
+ end
127
+
128
+ test 'code attribute is set' do
129
+ assert_true(@http.ping)
130
+ assert_equal('200', @http.code)
131
+ end
132
+
133
+ test 'user_agent accessor is defined' do
134
+ assert_respond_to(@http, :user_agent)
135
+ assert_respond_to(@http, :user_agent=)
136
+ end
137
+
138
+ test 'user_agent defaults to nil' do
139
+ assert_nil(@http.user_agent)
140
+ end
141
+
142
+ test 'ping with user agent' do
143
+ @http.user_agent = "KDDI-CA32"
144
+ assert_true(@http.ping)
145
+ end
146
+
147
+ test 'redirect_limit accessor is defined' do
148
+ assert_respond_to(@http, :redirect_limit)
149
+ assert_respond_to(@http, :redirect_limit=)
150
+ end
151
+
152
+ test 'redirect_limit defaults to 5' do
153
+ assert_equal(5, @http.redirect_limit)
154
+ end
155
+
156
+ test 'redirects succeed by default' do
157
+ @http = Net::Ping::HTTP.new("http://jigsaw.w3.org/HTTP/300/302.html")
158
+ assert_true(@http.ping)
159
+ end
160
+
161
+ test 'redirect fail if follow_redirect is set to false' do
162
+ @http = Net::Ping::HTTP.new("http://jigsaw.w3.org/HTTP/300/302.html")
163
+ @http.follow_redirect = false
164
+ assert_false(@http.ping)
165
+ end
166
+
167
+ test 'ping with redirect limit set to zero fails' do
168
+ @http = Net::Ping::HTTP.new("http://jigsaw.w3.org/HTTP/300/302.html")
169
+ @http.redirect_limit = 0
170
+ assert_false(@http.ping)
171
+ assert_equal("Redirect limit exceeded", @http.exception)
172
+ end
173
+
174
+ test 'http 502 sets exception' do
175
+ @http = Net::Ping::HTTP.new("http://http502.com")
176
+ assert_false(@http.ping)
177
+ assert_equal('Bad Gateway', @http.exception)
178
+ end
179
+
180
+ test 'http 502 sets code' do
181
+ @http = Net::Ping::HTTP.new("http://http502.com")
182
+ assert_false(@http.ping)
183
+ assert_equal('502', @http.code)
184
+ end
185
+
186
+ test 'ping against https site defaults to port 443' do
187
+ @http = Net::Ping::HTTP.new(@uri_https)
188
+ assert_equal(443, @http.port)
189
+ end
190
+
191
+ test 'ping against https site works as expected' do
192
+ @http = Net::Ping::HTTP.new(@uri_https)
193
+ assert_true(@http.ping)
194
+ end
195
+
196
+ test 'ping with get option' do
197
+ @http = Net::Ping::HTTP.new(@uri)
198
+ @http.get_request = true
199
+ assert_true(@http.ping)
200
+ end
201
+
202
+ test 'ping with http proxy' do
203
+ ENV['http_proxy'] = "http://proxymoxie:3128"
204
+ @http = Net::Ping::HTTP.new(@uri)
205
+ @http.get_request = true
206
+ assert_true(@http.ping)
207
+ assert_true(@http.proxied)
208
+ end
209
+
210
+ test 'ping with https proxy' do
211
+ ENV['https_proxy'] = "http://proxymoxie:3128"
212
+ @http = Net::Ping::HTTP.new(@uri_https)
213
+ @http.get_request = true
214
+ assert_true(@http.ping)
215
+ assert_true(@http.proxied)
216
+ end
217
+
218
+ test 'ping with no_proxy' do
219
+ ENV['no_proxy'] = "google.com"
220
+ @http = Net::Ping::HTTP.new(@uri)
221
+ @http.get_request = true
222
+ assert_true(@http.ping)
223
+ assert_false(@http.proxied)
224
+ end
225
+
226
+ def teardown
227
+ @uri = nil
228
+ @http = nil
229
+ end
230
+ end
@@ -1,139 +1,139 @@
1
- #######################################################################
2
- # test_net_ping_icmp.rb
3
- #
4
- # Test case for the Net::PingICMP class. You must run this test case
5
- # with root privileges on UNIX systems. This should be run via the
6
- # 'test' or 'test:icmp' Rake task.
7
- #######################################################################
8
- require 'test-unit'
9
- require 'net/ping/icmp'
10
-
11
- if File::ALT_SEPARATOR
12
- require 'win32/security'
13
-
14
- unless Win32::Security.elevated_security?
15
- raise "The test:icmp task must be run with elevated security rights"
16
- end
17
- else
18
- unless Process.euid == 0
19
- raise "The test:icmp task must be run with root privileges"
20
- end
21
- end
22
-
23
- class TC_PingICMP < Test::Unit::TestCase
24
- def setup
25
- @host = '127.0.0.1' # 'localhost'
26
- @icmp = Net::Ping::ICMP.new(@host)
27
- end
28
-
29
- test "icmp ping basic functionality" do
30
- assert_respond_to(@icmp, :ping)
31
- assert_nothing_raised{ @icmp.ping }
32
- end
33
-
34
- test "icmp ping accepts a host" do
35
- assert_nothing_raised{ @icmp.ping(@host) }
36
- end
37
-
38
- test "icmp ping returns a boolean" do
39
- assert_boolean(@icmp.ping)
40
- assert_boolean(@icmp.ping(@host))
41
- end
42
-
43
- test "icmp ping of local host is successful" do
44
- assert_true(Net::Ping::ICMP.new(@host).ping?)
45
- assert_true(Net::Ping::ICMP.new('192.168.0.1').ping?)
46
- end
47
-
48
- test "ping? is an alias for ping" do
49
- assert_respond_to(@icmp, :ping?)
50
- assert_alias_method(@icmp, :ping?, :ping)
51
- end
52
-
53
- test "pingecho is an alias for ping" do
54
- assert_respond_to(@icmp, :pingecho)
55
- assert_alias_method(@icmp, :pingecho, :ping)
56
- end
57
-
58
- test "icmp ping fails if host is invalid" do
59
- assert_false(Net::Ping::ICMP.new('bogus').ping?)
60
- assert_false(Net::Ping::ICMP.new('http://www.asdfhjklasdfhlkj.com').ping?)
61
- end
62
-
63
- test "bind method basic functionality" do
64
- assert_respond_to(@icmp, :bind)
65
- assert_nothing_raised{ @icmp.bind(Socket.gethostname) }
66
- assert_nothing_raised{ @icmp.bind(Socket.gethostname, 80) }
67
- end
68
-
69
- test "duration method basic functionality" do
70
- assert_nothing_raised{ @icmp.ping }
71
- assert_respond_to(@icmp, :duration)
72
- assert_kind_of(Float, @icmp.duration)
73
- end
74
-
75
- test "host getter method basic functionality" do
76
- assert_respond_to(@icmp, :host)
77
- assert_equal(@host, @icmp.host)
78
- end
79
-
80
- test "host setter method basic functionality" do
81
- assert_respond_to(@icmp, :host=)
82
- assert_nothing_raised{ @icmp.host = '192.168.0.1' }
83
- assert_equal(@icmp.host, '192.168.0.1')
84
- end
85
-
86
- test "port method basic functionality" do
87
- assert_respond_to(@icmp, :port)
88
- assert_equal(nil, @icmp.port)
89
- end
90
-
91
- test "timeout getter method basic functionality" do
92
- assert_respond_to(@icmp, :timeout)
93
- assert_equal(5, @icmp.timeout)
94
- end
95
-
96
- test "timeout setter method basic functionality" do
97
- assert_respond_to(@icmp, :timeout=)
98
- assert_nothing_raised{ @icmp.timeout = 7 }
99
- assert_equal(7, @icmp.timeout)
100
- end
101
-
102
- test "exception method basic functionality" do
103
- assert_respond_to(@icmp, :exception)
104
- assert_nothing_raised{ @icmp.ping }
105
- end
106
-
107
- test "exception method returns nil if no ping has happened yet" do
108
- assert_nil(@icmp.exception)
109
- end
110
-
111
- test "warning method basic functionality" do
112
- assert_respond_to(@icmp, :warning)
113
- end
114
-
115
- test "data_size getter method basic functionality" do
116
- assert_respond_to(@icmp, :data_size)
117
- assert_nothing_raised{ @icmp.data_size }
118
- assert_kind_of(Numeric, @icmp.data_size)
119
- end
120
-
121
- test "data_size returns expected value" do
122
- assert_equal(56, @icmp.data_size)
123
- end
124
-
125
- test "data_size setter method basic functionality" do
126
- assert_respond_to(@icmp, :data_size=)
127
- assert_nothing_raised{ @icmp.data_size = 22 }
128
- end
129
-
130
- test "setting an odd data_size is valid" do
131
- assert_nothing_raised{ @icmp.data_size = 57 }
132
- assert_boolean(@icmp.ping)
133
- end
134
-
135
- def teardown
136
- @host = nil
137
- @icmp = nil
138
- end
139
- end
1
+ #######################################################################
2
+ # test_net_ping_icmp.rb
3
+ #
4
+ # Test case for the Net::PingICMP class. You must run this test case
5
+ # with root privileges on UNIX systems. This should be run via the
6
+ # 'test' or 'test:icmp' Rake task.
7
+ #######################################################################
8
+ require 'test-unit'
9
+ require 'net/ping/icmp'
10
+
11
+ if File::ALT_SEPARATOR
12
+ require 'win32/security'
13
+
14
+ unless Win32::Security.elevated_security?
15
+ raise "The test:icmp task must be run with elevated security rights"
16
+ end
17
+ else
18
+ unless Process.euid == 0
19
+ raise "The test:icmp task must be run with root privileges"
20
+ end
21
+ end
22
+
23
+ class TC_PingICMP < Test::Unit::TestCase
24
+ def setup
25
+ @host = '127.0.0.1' # 'localhost'
26
+ @icmp = Net::Ping::ICMP.new(@host)
27
+ end
28
+
29
+ test "icmp ping basic functionality" do
30
+ assert_respond_to(@icmp, :ping)
31
+ assert_nothing_raised{ @icmp.ping }
32
+ end
33
+
34
+ test "icmp ping accepts a host" do
35
+ assert_nothing_raised{ @icmp.ping(@host) }
36
+ end
37
+
38
+ test "icmp ping returns a boolean" do
39
+ assert_boolean(@icmp.ping)
40
+ assert_boolean(@icmp.ping(@host))
41
+ end
42
+
43
+ test "icmp ping of local host is successful" do
44
+ assert_true(Net::Ping::ICMP.new(@host).ping?)
45
+ assert_true(Net::Ping::ICMP.new('192.168.0.1').ping?)
46
+ end
47
+
48
+ test "ping? is an alias for ping" do
49
+ assert_respond_to(@icmp, :ping?)
50
+ assert_alias_method(@icmp, :ping?, :ping)
51
+ end
52
+
53
+ test "pingecho is an alias for ping" do
54
+ assert_respond_to(@icmp, :pingecho)
55
+ assert_alias_method(@icmp, :pingecho, :ping)
56
+ end
57
+
58
+ test "icmp ping fails if host is invalid" do
59
+ assert_false(Net::Ping::ICMP.new('bogus').ping?)
60
+ assert_false(Net::Ping::ICMP.new('http://www.asdfhjklasdfhlkj.com').ping?)
61
+ end
62
+
63
+ test "bind method basic functionality" do
64
+ assert_respond_to(@icmp, :bind)
65
+ assert_nothing_raised{ @icmp.bind(Socket.gethostname) }
66
+ assert_nothing_raised{ @icmp.bind(Socket.gethostname, 80) }
67
+ end
68
+
69
+ test "duration method basic functionality" do
70
+ assert_nothing_raised{ @icmp.ping }
71
+ assert_respond_to(@icmp, :duration)
72
+ assert_kind_of(Float, @icmp.duration)
73
+ end
74
+
75
+ test "host getter method basic functionality" do
76
+ assert_respond_to(@icmp, :host)
77
+ assert_equal(@host, @icmp.host)
78
+ end
79
+
80
+ test "host setter method basic functionality" do
81
+ assert_respond_to(@icmp, :host=)
82
+ assert_nothing_raised{ @icmp.host = '192.168.0.1' }
83
+ assert_equal(@icmp.host, '192.168.0.1')
84
+ end
85
+
86
+ test "port method basic functionality" do
87
+ assert_respond_to(@icmp, :port)
88
+ assert_equal(nil, @icmp.port)
89
+ end
90
+
91
+ test "timeout getter method basic functionality" do
92
+ assert_respond_to(@icmp, :timeout)
93
+ assert_equal(5, @icmp.timeout)
94
+ end
95
+
96
+ test "timeout setter method basic functionality" do
97
+ assert_respond_to(@icmp, :timeout=)
98
+ assert_nothing_raised{ @icmp.timeout = 7 }
99
+ assert_equal(7, @icmp.timeout)
100
+ end
101
+
102
+ test "exception method basic functionality" do
103
+ assert_respond_to(@icmp, :exception)
104
+ assert_nothing_raised{ @icmp.ping }
105
+ end
106
+
107
+ test "exception method returns nil if no ping has happened yet" do
108
+ assert_nil(@icmp.exception)
109
+ end
110
+
111
+ test "warning method basic functionality" do
112
+ assert_respond_to(@icmp, :warning)
113
+ end
114
+
115
+ test "data_size getter method basic functionality" do
116
+ assert_respond_to(@icmp, :data_size)
117
+ assert_nothing_raised{ @icmp.data_size }
118
+ assert_kind_of(Numeric, @icmp.data_size)
119
+ end
120
+
121
+ test "data_size returns expected value" do
122
+ assert_equal(56, @icmp.data_size)
123
+ end
124
+
125
+ test "data_size setter method basic functionality" do
126
+ assert_respond_to(@icmp, :data_size=)
127
+ assert_nothing_raised{ @icmp.data_size = 22 }
128
+ end
129
+
130
+ test "setting an odd data_size is valid" do
131
+ assert_nothing_raised{ @icmp.data_size = 57 }
132
+ assert_boolean(@icmp.ping)
133
+ end
134
+
135
+ def teardown
136
+ @host = nil
137
+ @icmp = nil
138
+ end
139
+ end