Ejemplo n.º 1
0
def test_parse_uri_serial_baudrate_no_username():
    result = ParsedUri("serial:///dev/ttyUSB3?baudrate=115200")
    assert result.scheme == "serial"
    assert result.port == "/dev/ttyUSB3"
    assert result.baudrate == 115200
Ejemplo n.º 2
0
def test_parse_uri_serial_baudrate_no_username_baudrate_kwargs():
    result = ParsedUri("serial:///dev/ttyUSB3", baudrate=5252)
    assert result.scheme == "serial"
    assert result.port == "/dev/ttyUSB3"
    assert result.baudrate == 5252
Ejemplo n.º 3
0
def test_parse_uri_username_in_uri_and_as_arg():
    with raises(RuntimeError):
        ParsedUri("myscheme://[email protected]", username="******")
Ejemplo n.º 4
0
def test_parse_uri_password_in_uri_and_as_arg():
    with raises(RuntimeError):
        ParsedUri("myscheme://*****:*****@thehostname.com",
                  password="******")
Ejemplo n.º 5
0
def test_parsed_uri_fill_in_default_port():
    assert ParsedUri("ssh://john@hostname").port == 22
    assert ParsedUri("telnet://john@hostname").port == 23
    assert ParsedUri("adb://hostname").port == 5555
Ejemplo n.º 6
0
def test_parsed_uri_ssh_username_as_arg():
    ParsedUri("ssh://hostname", username="******")
Ejemplo n.º 7
0
def test_parsed_uri_ssh_no_username():
    with raises(RuntimeError,
                message="scheme 'ssh' requires 'hostname' and 'username'"):
        ParsedUri("ssh://hostname")
Ejemplo n.º 8
0
def test_parsed_uri_telnet_username_as_arg():
    ParsedUri("telnet://hostname", username="******")
Ejemplo n.º 9
0
def test_parsed_uri_telnet_no_username():
    with raises(RuntimeError,
                message="scheme 'telnet' requires 'hostname' and 'username'"):
        ParsedUri("telnet://hostname")