added some more test cases
This commit is contained in:
parent
a56d249a80
commit
3f14b54014
|
@ -88,6 +88,7 @@ module Net
|
||||||
@pdu_type = args[:pdu_type] # leave nil unless specified; there's no reasonable default value.
|
@pdu_type = args[:pdu_type] # leave nil unless specified; there's no reasonable default value.
|
||||||
@error_status = args[:error_status] || 0
|
@error_status = args[:error_status] || 0
|
||||||
@error_index = args[:error_index] || 0
|
@error_index = args[:error_index] || 0
|
||||||
|
@variables = args[:variables] || []
|
||||||
end
|
end
|
||||||
|
|
||||||
#--
|
#--
|
||||||
|
|
|
@ -75,6 +75,8 @@ class TestSnmp < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_malformations
|
def test_malformations
|
||||||
pdu = Net::SnmpPdu.new
|
pdu = Net::SnmpPdu.new
|
||||||
|
pdu.version = 0
|
||||||
|
pdu.version = 2
|
||||||
assert_raise( Net::SnmpPdu::Error ) {
|
assert_raise( Net::SnmpPdu::Error ) {
|
||||||
pdu.version = 100
|
pdu.version = 100
|
||||||
}
|
}
|
||||||
|
@ -102,6 +104,15 @@ class TestSnmp < Test::Unit::TestCase
|
||||||
assert_equal( SnmpGetResponse, pdu.to_ber_string )
|
assert_equal( SnmpGetResponse, pdu.to_ber_string )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_make_bad_response
|
||||||
|
pdu = Net::SnmpPdu.new
|
||||||
|
assert_raise(Net::SnmpPdu::Error) {pdu.to_ber_string}
|
||||||
|
pdu.pdu_type = :get_response
|
||||||
|
pdu.request_id = 999
|
||||||
|
pdu.to_ber_string
|
||||||
|
# Not specifying variables doesn't create an error. (Maybe it should?)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue