Skip to content

Commit

Permalink
Fixed unit test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Nov 3, 2024
1 parent cb2ab5a commit d9ad079
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from tests.agent_context import AGENT_PORT, AgentContextManager


total_count = 212 # 267


@pytest.mark.asyncio
async def test_v1_walk():
async with AgentContextManager():
Expand Down Expand Up @@ -30,7 +33,7 @@ async def test_v1_walk():
assert len(varBinds) == 1
assert varBinds[0][0].prettyPrint() == "SNMPv2-MIB::sysUpTime.0"

assert len(objects_list) == 267
assert len(objects_list) == total_count

snmpDispatcher.transport_dispatcher.close_dispatcher()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from tests.agent_context import AGENT_PORT, AgentContextManager


total_count = 212 # 267


@pytest.mark.asyncio
async def test_v2_walk(): # some agents have different v2 GET NEXT behavior
async with AgentContextManager():
Expand Down Expand Up @@ -30,7 +33,7 @@ async def test_v2_walk(): # some agents have different v2 GET NEXT behavior
assert len(varBinds) == 1
assert varBinds[0][0].prettyPrint() == "SNMPv2-MIB::sysUpTime.0"

assert len(objects_list) == 267
assert len(objects_list) == total_count

snmpDispatcher.transport_dispatcher.close_dispatcher()

Expand Down
6 changes: 4 additions & 2 deletions tests/hlapi/v3arch/asyncio/manager/cmdgen/test_v1_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from pysnmp.smi.view import MibViewController
from tests.agent_context import AGENT_PORT, AgentContextManager

total_count = 212 # 267


@pytest.mark.asyncio
async def test_v1_walk():
Expand Down Expand Up @@ -33,7 +35,7 @@ async def test_v1_walk():
assert len(varBinds) == 1
assert varBinds[0][0].prettyPrint() == "SNMPv2-MIB::sysUpTime.0"

assert len(objects_list) == 267
assert len(objects_list) == total_count

snmpEngine.close_dispatcher()

Expand Down Expand Up @@ -76,7 +78,7 @@ async def test_v1_walk_mib():
assert len(varBinds) == 1
assert varBinds[0][0].prettyPrint() == "SNMPv2-MIB::sysUpTime.0"

assert len(objects_list) == 267
assert len(objects_list) == total_count

errorIndication, errorStatus, errorIndex, varBinds = objects_list[-1]
assert (
Expand Down
4 changes: 3 additions & 1 deletion tests/hlapi/v3arch/asyncio/manager/cmdgen/test_v2_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from pysnmp.hlapi.v3arch.asyncio import *
from tests.agent_context import AGENT_PORT, AgentContextManager

total_count = 212 # 267


@pytest.mark.asyncio
async def test_v2_walk(): # some agents have different v2 GET NEXT behavior
Expand Down Expand Up @@ -31,7 +33,7 @@ async def test_v2_walk(): # some agents have different v2 GET NEXT behavior
assert len(varBinds) == 1
assert varBinds[0][0].prettyPrint() == "SNMPv2-MIB::sysUpTime.0"

assert len(objects_list) == 267
assert len(objects_list) == total_count

snmpEngine.close_dispatcher()

Expand Down

0 comments on commit d9ad079

Please sign in to comment.