Esempio n. 1
0
def test_stop_buzzer():
    serial = MockSerial(ACK)
    attiny = AttinyProtocol(serial)
    result = attiny.stop_buzzer()

    assert result == True
    assert serial.received == STOP_BUZZER
Esempio n. 2
0
def test_stop_buzzer_invalid():
    serial = MockSerial(INVALID_RESPONSE)
    attiny = AttinyProtocol(serial)

    with pytest.raises(InvalidResponseException):
        attiny.stop_buzzer()
Esempio n. 3
0
def test_stop_buzzer_timeout():
    serial = MockSerial(b'')
    attiny = AttinyProtocol(serial)
    result = attiny.stop_buzzer()

    assert result == False
Esempio n. 4
0
def test_stop_buzzer_nak():
    serial = MockSerial(NAK)
    attiny = AttinyProtocol(serial)
    result = attiny.stop_buzzer()

    assert result == False