Example #1
0
def test_parse_device():
    input = "1ccb04bb\tdevice\n"
    expected = [("1ccb04bb", "device")]
    assert parse_device_list(input) == expected

    input = "1ccb04bb\tdevice\n950a8ad5\tunauthorized\n"
    expected = [("1ccb04bb", "device"), ("950a8ad5", "unauthorized")]
    assert parse_device_list(input) == expected

    input = ""
    expected = []
    assert parse_device_list(input) == expected

    input = "1ccb04bb\tdevice\n950a8ad5\tunauthorized\n1234567\toffline\n"
    expected = [
        ("1ccb04bb", "device"),
        ("950a8ad5", "unauthorized"),
        ("1234567", "offline"),
    ]
    assert parse_device_list(input) == expected
Example #2
0
    def devices(self):
        """
        Return a list of connected devices in the form (*serial*, *status*) where status can
        be any of the following:

        1. device
        2. offline
        3. unauthorized

        :returns: A list of tuples representing connected devices
        """
        devices = None
        with self.socket.Connect():
            devices = self._command("host:devices")

        return parse_device_list(devices)
Example #3
0
    def devices(self):
        """
        Return a list of connected devices in the form (*serial*, *status*) where status can
        be any of the following:

        1. device
        2. offline
        3. unauthorized

        :returns: A list of tuples representing connected devices
        """
        devices = None
        with self.socket.Connect():
            devices = self._command("host:devices")

        return parse_device_list(devices)