Example #1
0
    def test_lastWrite_isRecorded(self):
        serial = StubbedArduinoSerial()
        serial.write( 'test' )

        last = serial.getLastWrite()

        assert last == 'test'
Example #2
0
    def test_suppliedReadResponse_isReturned(self):
        serial = StubbedArduinoSerial()
        serial.setReadResponse( 'test' )

        response = serial.read()
    
        assert response == 'test'
Example #3
0
    def test_setLed_off(self):
        serial = StubbedArduinoSerial()
        driver = ArduinoMatrixDriver(serial)

        driver.setLed( 'anLed', False )
        
        sent = serial.getLastWrite()
        assert sent == 'LED anLed off\n'
Example #4
0
    def test_ledOff(self):
        serial = StubbedArduinoSerial()
        driver = ArduinoMatrixDriver(serial)

        driver.ledOff( 'anLed' )
        
        sent = serial.getLastWrite()
        assert sent == 'LED anLed off\n'
Example #5
0
    def test_setMeter(self):
        serial = StubbedArduinoSerial()
        driver = ArduinoMatrixDriver(serial)

        driver.setMeter( 'aMeter', 10 )
        
        sent = serial.getLastWrite()
        assert sent == 'Meter aMeter 10\n'
Example #6
0
 def serial(self):
     return StubbedArduinoSerial()
Example #7
0
 def serial(self):
     from missionControl.arduino import StubbedArduinoSerial
     return StubbedArduinoSerial()
Example #8
0
    def test_hasSent_returnsFalseIfMessageNotSent(self):
        serial = StubbedArduinoSerial()
        serial.write( 'test' )

        assert not serial.hasSent( 'test 2' )
Example #9
0
    def test_hasSent(self):
        serial = StubbedArduinoSerial()
        serial.write( 'test' )

        assert serial.hasSent( 'test' )
Example #10
0
    def test_defaultReadResponse_isNone(self):
        response = StubbedArduinoSerial().read()

        assert response is None
Example #11
0
    def test_lastWrite_returnsNoneIfNoMessages(self):
        serial = StubbedArduinoSerial()

        last = serial.getLastWrite()

        assert last is None
Example #12
0
    def test_lastWrite_defaultsToNone(self):
        serial = StubbedArduinoSerial()

        last = serial.getLastWrite()

        assert last == None