Permalink
Browse files

tests/serialdriver: test rfc2711 and raw protocol instances

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
  • Loading branch information...
Emantor committed Sep 22, 2017
1 parent 085d21a commit e3ec831d7dd4857ab97df42896c5be1dccc7d76e
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/test_serialdriver.py
View
@@ -47,3 +47,27 @@ def test_close(self, target, monkeypatch, serial_port, mocker):
target.activate(s)
s.close()
assert (serial_mock.close.called)
def test_deactivate(self, target, monkeypatch, serial_port, mocker):
serial_mock = mocker.Mock()
serial_mock.close = mocker.MagicMock()
monkeypatch.setattr(serial, 'Serial', serial_mock)
s = SerialDriver(target)
s.serial = serial_mock
target.activate(s)
target.deactivate(s)
assert (serial_mock.close.called)
def test_rfc2711_instanziation(self, target, serial_rfc2711_port, monkeypatch, mocker):
serial_mock = mocker.Mock()
monkeypatch.setattr(serial, 'Serial', serial_mock)
s = SerialDriver(target)
assert (isinstance(s, SerialDriver))
assert (target.drivers[0] == s)
def test_raw_instanziation(self, target, serial_raw_port, monkeypatch, mocker):
serial_mock = mocker.Mock()
monkeypatch.setattr(serial, 'Serial', serial_mock)
s = SerialDriver(target)
assert (isinstance(s, SerialDriver))
assert (target.drivers[0] == s)

0 comments on commit e3ec831

Please sign in to comment.