Skip to content

Commit

Permalink
Add test for heartbeat command
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Dec 25, 2024
1 parent 3c42592 commit 6f8f8e1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_command_heartbeat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: José Sánchez-Gallego ([email protected])
# @Date: 2024-12-24
# @Filename: test_command_heartbeat.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)

from __future__ import annotations

from typing import TYPE_CHECKING


if TYPE_CHECKING:
from pytest_mock import MockerFixture

from lvmecp.actor import ECPActor


async def test_command_heartbeat(actor: ECPActor, mocker: MockerFixture):
hb_set_mock = mocker.patch.object(actor.plc.modbus["hb_set"], "set")

cmd = await actor.invoke_mock_command("heartbeat")
await cmd

assert cmd.status.did_succeed

hb_set_mock.assert_called_once_with(True)

0 comments on commit 6f8f8e1

Please sign in to comment.