Skip to content

Commit

Permalink
Added a missing test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Feb 5, 2024
1 parent d420f1d commit 8bfb17e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/hlapi/asyncio/manager/cmdgen/test_usm_sha_none.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from pysnmp.hlapi.asyncio import *
from pysnmp.proto.errind import UnknownUserName
from pysnmp.proto.errind import UnknownUserName, WrongDigest

@pytest.mark.asyncio
async def test_usm_sha_none():
Expand All @@ -26,6 +26,27 @@ async def test_usm_sha_none():

snmpEngine.transportDispatcher.closeDispatcher()

@pytest.mark.asyncio
async def test_usm_sha_none_wrong_auth():
snmpEngine = SnmpEngine()
authData = UsmUserData(
"usr-sha-none",
"authkey1",
authProtocol=usmHMACMD5AuthProtocol, # wrongly use usmHMACMD5AuthProtocol
)
errorIndication, errorStatus, errorIndex, varBinds = await getCmd(
snmpEngine,
authData,
UdpTransportTarget(("demo.pysnmp.com", 161), retries=0),
ContextData(),
ObjectType(ObjectIdentity("SNMPv2-MIB", "sysDescr", 0)),
)

assert isinstance(errorIndication, WrongDigest)
assert str(errorIndication) == 'Wrong SNMP PDU digest'

snmpEngine.transportDispatcher.closeDispatcher()

@pytest.mark.asyncio
async def test_usm_sha_none_wrong_user():
snmpEngine = SnmpEngine()
Expand Down

0 comments on commit 8bfb17e

Please sign in to comment.