From 32bfd146b950a90cdb6188e58d087a074201f994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Bouliane?= Date: Thu, 27 Jul 2017 13:45:18 -0400 Subject: [PATCH] Add errors that were added with pysnmp 4.3.6 We recreate pysnmp errors within virtualpdu and errors has changed with pysnmp 4.3.6 By adding the test name, the exceptions are now in sync. Change-Id: I2d4dccde08bd85a166e8dd3e0f1d0708ea0f0c69 --- virtualpdu/tests/snmp_error_indications.py | 12 ++++++++++++ virtualpdu/tests/unit/test_snmp_client.py | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/virtualpdu/tests/snmp_error_indications.py b/virtualpdu/tests/snmp_error_indications.py index 9cf72d5..4b74736 100644 --- a/virtualpdu/tests/snmp_error_indications.py +++ b/virtualpdu/tests/snmp_error_indications.py @@ -175,3 +175,15 @@ class SNMPApplicationError(SNMPErrorIndication): class OidNotIncreasing(SNMPApplicationError): pass + + +class ReportPduReceived(SNMPErrorIndication): + pass + + +class UnknownUserName(SNMPErrorIndication): + pass + + +class WrongDigest(SNMPErrorIndication): + pass diff --git a/virtualpdu/tests/unit/test_snmp_client.py b/virtualpdu/tests/unit/test_snmp_client.py index c0159b5..bc4536e 100644 --- a/virtualpdu/tests/unit/test_snmp_client.py +++ b/virtualpdu/tests/unit/test_snmp_client.py @@ -17,6 +17,9 @@ from mock import sentinel from pysnmp.proto import errind from pysnmp.proto.errind import ErrorIndication from pysnmp.proto.rfc1905 import NoSuchInstance + +import testtools + from virtualpdu.tests import base from virtualpdu.tests import snmp_client from virtualpdu.tests import snmp_error_indications @@ -92,8 +95,8 @@ class TestSnmpClient(base.TestCase): exception_class = snmp_error_indications.__dict__.get(class_name) - self.assertRaises(exception_class, - self.snmp_client.get_one, oid) + with testtools.ExpectedException(exception_class): + self.snmp_client.get_one(oid) def test_set(self): oid = (1, 3, 6)