Esempio n. 1
0
 def test_read_verbose(self):
     """When verbose channel provided, reads are echoed."""
     s = Mock(read=Mock(return_value=b"passes"))
     verb = Mock()
     n = NodeMCU(s, verb)
     assert n.read(6) == b"passes"
     verb.write.assert_called_once_with(b"passes")
Esempio n. 2
0
 def test_read_verbose(self):
     """When verbose channel provided, reads are echoed."""
     s = Mock(read=Mock(return_value=b"passes"))
     verb = Mock()
     n = NodeMCU(s, verb)
     assert n.read(6) == b"passes"
     verb.write.assert_called_once_with(b"passes")
Esempio n. 3
0
 def test_read_timeout(self):
     """Make sure read fails when wrong response length received."""
     s = Mock(read=Mock(return_value=b"fails"))
     n = NodeMCU(s)
     with pytest.raises(IOError):
         n.read(6)
Esempio n. 4
0
 def test_read(self):
     """Read wrapper should work as expected..."""
     s = Mock(read=Mock(return_value=b"passes"))
     n = NodeMCU(s)
     assert n.read(6) == b"passes"
Esempio n. 5
0
 def test_read_timeout(self):
     """Make sure read fails when wrong response length received."""
     s = Mock(read=Mock(return_value=b"fails"))
     n = NodeMCU(s)
     with pytest.raises(IOError):
         n.read(6)
Esempio n. 6
0
 def test_read(self):
     """Read wrapper should work as expected..."""
     s = Mock(read=Mock(return_value=b"passes"))
     n = NodeMCU(s)
     assert n.read(6) == b"passes"