Exemplo n.º 1
0
def test_get_frequency(fake_target):
    DEFAULT_CONFIG["hostname"] = "127.0.0.1"
    DEFAULT_CONFIG["port"] = "80"
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = "f"
    rigctl.get_frequency()
    rigctl._request == "f"
Exemplo n.º 2
0
def test_get_connection_refused(hostname, port):
    DEFAULT_CONFIG["hostname"] = hostname
    DEFAULT_CONFIG["port"] = port
    rigctl = RigCtl()
    with pytest.raises(socket.error):
        rigctl.get_frequency()
Exemplo n.º 3
0
def test_get_frequency_error(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = 22
    with pytest.raises(ValueError):
        rigctl.get_frequency()
Exemplo n.º 4
0
def test_request_socket_error(fake_target):
    telnetlib.Telnet = MagicMock(side_effect=socket.error)
    rigctl = RigCtl(fake_target)
    with pytest.raises(socket.error):
        rigctl.get_frequency()