Skip to content

Commit

Permalink
Fix obsolete patch statements
Browse files Browse the repository at this point in the history
These test patches will not work now that everything uses
`zino.snmp.get_snmp_session()` - the SNMP class needs to be patched
in the correct location.
  • Loading branch information
lunkwill42 committed Jan 24, 2025
1 parent 1b49d35 commit 6951c0b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/tasks/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def unreachable_task():
device = PollDevice(name="nonexist", address="127.0.0.1", community="invalid", port=666)
state = ZinoState()
task = ReachableTask(device, state)
with patch("zino.tasks.task.SNMP.get") as get_mock:
with patch("zino.snmp.SNMP.get") as get_mock:
get_mock.side_effect = TimeoutError
yield task
task._deschedule_extra_job()
2 changes: 1 addition & 1 deletion tests/tasks/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def test_get_sysuptime_raises_timeout_error(self):
device = PollDevice(name="nonexist", address="127.0.0.1", community="invalid", port=666)
state = ZinoState()
task = ReachableTask(device, state)
with patch("zino.tasks.task.SNMP.get") as get_mock:
with patch("zino.snmp.SNMP.get") as get_mock:
get_mock.side_effect = TimeoutError
with pytest.raises(TimeoutError):
await task._get_uptime()
2 changes: 1 addition & 1 deletion tests/tasks/test_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def test_run_should_raise_exception_when_there_is_no_response(self):
device = PollDevice(name="localhost", address="127.0.0.1", community="invalid", port=666)
state = ZinoState()
task = VendorTask(device, state)
with patch("zino.tasks.task.SNMP.get") as get_mock:
with patch("zino.snmp.SNMP.get") as get_mock:
get_mock.side_effect = TimeoutError
with pytest.raises(TimeoutError):
await task.run()
Expand Down

0 comments on commit 6951c0b

Please sign in to comment.