Ejemplo n.º 1
0
    def test_should_set_the_mode_on_the_first_command(self):
        mockOs = Mock()
        gpio_writer = GpioWriter(10, mockOs)
        gpio_writer.high()

        mockOs.system.assert_has_calls(
            [call("gpio -g mode 10 out"),
             call("gpio -g write 10 1")])
Ejemplo n.º 2
0
    def test_should_not_set_the_mode_on_the_second_command(self):
        mockOs = Mock()
        gpio_writer = GpioWriter(10,mockOs)
        gpio_writer.high()
        mockOs.reset_mock()
        gpio_writer.high()

        mockOs.system.assert_called_once_with("gpio -g write 10 1")
Ejemplo n.º 3
0
    def test_should_not_set_the_mode_on_the_second_command(self):
        mockOs = Mock()
        gpio_writer = GpioWriter(10, mockOs)
        gpio_writer.high()
        mockOs.reset_mock()
        gpio_writer.high()

        mockOs.system.assert_called_once_with("gpio -g write 10 1")
Ejemplo n.º 4
0
    def test_should_set_the_mode_on_the_first_command(self):
        mockOs = Mock()
        gpio_writer = GpioWriter(10,mockOs)
        gpio_writer.high()

        mockOs.system.assert_has_calls([call("gpio -g mode 10 out"),call("gpio -g write 10 1")])