diff --git a/tests/testsnmp.rb b/tests/testsnmp.rb index a5ad9ca..93cfb91 100644 --- a/tests/testsnmp.rb +++ b/tests/testsnmp.rb @@ -14,6 +14,8 @@ class TestSnmp < Test::Unit::TestCase SnmpGetRequest = "0'\002\001\000\004\006public\240\032\002\002?*\002\001\000\002\001\0000\0160\f\006\b+\006\001\002\001\001\001\000\005\000" SnmpGetResponse = "0+\002\001\000\004\006public\242\036\002\002'\017\002\001\000\002\001\0000\0220\020\006\b+\006\001\002\001\001\001\000\004\004test" + SnmpGetRequestXXX = "0'\002\001\000\004\006xxxxxx\240\032\002\002?*\002\001\000\002\001\0000\0160\f\006\b+\006\001\002\001\001\001\000\005\000" + def setup end @@ -122,6 +124,13 @@ class TestSnmp < Test::Unit::TestCase assert_equal( "C\001d", t32.to_ber ) end + def test_community + data = SnmpGetRequestXXX.dup + ary = data.read_ber(Net::SNMP::AsnSyntax) + pdu = Net::SnmpPdu.parse( ary ) + assert_equal( "xxxxxx", pdu.community ) + end + end