Exemplo n.º 1
1
def test_rig_reset():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_antenna("testparam")
Exemplo n.º 2
0
def test_set_frequency(hostname, port, fake_target):
    DEFAULT_CONFIG["hostname"] = "127.0.0.1"
    DEFAULT_CONFIG["port"] = "80"
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl.set_frequency("1000000")
    rigctl._request.assert_called_once_with('F 1000000', None)
Exemplo n.º 3
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.º 4
0
def scan_task():

    params = {}
    scanq = ""
    mode = "bookmarks"
    rig = None
    bookmark_list = []
    new_bookmark_list = []
    params["txt_range_min"] = TestStr("100")
    params["txt_range_max"] = TestStr("50")
    params["txt_delay"] = TestStr("1")
    params["txt_passes"] = TestStr("0")
    params["txt_sgn_level"] = TestStr("50")
    params["txt_interval"] = TestStr("100000")
    params["ckb_record"] = TestBool(False)
    params["ckb_log"] = TestBool(False)
    params["ckb_wait"] = TestBool(False)
    params["delay"] = 1
    params["ckb_auto_bookmark"] = TestBool(False)

    fake_target = {}
    fake_target["hostname"] = "127.0.0.1"
    fake_target["port"] = 80
    fake_target["rig_number"] = 1

    scan_task = ScanningTask(scanq, mode, bookmark_list, new_bookmark_list,
                             params, RigCtl(fake_target), "")
    return scan_task
Exemplo n.º 5
0
def test_bad_param(scanq, mode, bookmark_list, new_bookmark_list, min_freq,
                   max_freq, delay, passes, sgn_level, interval, record, log,
                   wait, auto_bookmark, fake_target):
    with pytest.raises(ValueError):

        params = {}
        params["txt_range_min"] = TestStr(min_freq)
        params["txt_range_max"] = TestStr(max_freq)
        params["txt_delay"] = TestStr(delay)
        params["txt_passes"] = TestStr(passes)
        params["txt_sgn_level"] = TestStr(sgn_level)
        params["txt_interval"] = TestStr(interval)
        params["ckb_record"] = TestBool(record)
        params["ckb_log"] = TestBool(log)
        params["ckb_wait"] = TestBool(wait)
        params["ckb_auto_bookmark"] = TestBool(auto_bookmark)

        ScanningTask(scanq, mode, bookmark_list, new_bookmark_list, params,
                     RigCtl(fake_target), "")
Exemplo n.º 6
0
def test_unsupported_scan_mode(fake_target):

    params = {}
    scanq = None
    mode = "test"
    bookmark_list = []
    new_bookmark_list = []
    params["txt_range_min"] = TestStr("100")
    params["txt_range_max"] = TestStr("50")
    params["txt_delay"] = TestStr("1")
    params["txt_passes"] = TestStr("0")
    params["txt_sgn_level"] = TestStr("50")
    params["txt_interval"] = TestStr("100000")
    params["ckb_record"] = TestBool(False)
    params["ckb_log"] = TestBool(False)
    params["ckb_wait"] = TestBool(False)
    params["ckb_auto_bookmark"] = TestBool(False)

    with pytest.raises(UnsupportedScanningConfigError):
        scan_task = ScanningTask(scanq, mode, bookmark_list, new_bookmark_list,
                                 params, RigCtl(fake_target), "")
Exemplo n.º 7
0
def test_mode_1():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_mode(22)
Exemplo n.º 8
0
def test_mode_2(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_mode("testmode")
Exemplo n.º 9
0
def test_split_freq():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_split_freq("testvfo")
Exemplo n.º 10
0
def test_parm_1():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_parm(22)
Exemplo n.º 11
0
def test_set_antenna():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_antenna("testreset")
Exemplo n.º 12
0
def test_vfo_1():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_vfo(22)
Exemplo n.º 13
0
def test_split_freq(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_split_freq("testvfo")
Exemplo n.º 14
0
def test_set_frequency():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_frequency("test")
Exemplo n.º 15
0
def test_rit(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_rit("testrit")
Exemplo n.º 16
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()
Exemplo n.º 17
0
def test_antenna(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_antenna("testparm")
Exemplo n.º 18
0
def test_func_2(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_func("testvfo")
Exemplo n.º 19
0
def test_rig_control():
    with pytest.raises(TypeError):
        rigctl = RigCtl("test")
Exemplo n.º 20
0
def test_set_mode(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl.set_mode("AM")
    rigctl._request.assert_called_once_with('M AM', None)
Exemplo n.º 21
0
def test_get_level(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = "22"
    assert(rigctl.get_level() == "22")
Exemplo n.º 22
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.º 23
0
def test_set_bad_frequency(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_frequency("test")
Exemplo n.º 24
0
def test_rig_reset():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.rig_reset("testreset")
Exemplo n.º 25
0
def test_set_bad_mode(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_mode(5)
Exemplo n.º 26
0
def test_xit():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_xit(22)
Exemplo n.º 27
0
def test_split_mode_1(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_split_mode(22)
Exemplo n.º 28
0
def test_vfo_2():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_vfo("testvfo")
Exemplo n.º 29
0
def test_get_antenna(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = 22
    assert(rigctl.get_antenna() == 22)
Exemplo n.º 30
0
def test_rit():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_rit("testrit")
Exemplo n.º 31
0
def test_mode_2():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_mode("testmode")
Exemplo n.º 32
0
def test_parm_2():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_parm("testparm")
Exemplo n.º 33
0
def test_func_1():
    rigctl = RigCtl()
    with pytest.raises(ValueError):
        rigctl.set_func(22)
Exemplo n.º 34
0
def test_get_mode(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = "m"
    assert(rigctl.get_mode() == "m")
Exemplo n.º 35
0
def test_parm_1(fake_target):
    rigctl = RigCtl(fake_target)
    with pytest.raises(ValueError):
        rigctl.set_parm(22)
Exemplo n.º 36
0
def test_get_mode_error(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = 22
    with pytest.raises(ValueError):
        rigctl.get_mode()
Exemplo n.º 37
0
def test_get_antenna_error(fake_target):
    rigctl = RigCtl(fake_target)
    rigctl._request = MagicMock()
    rigctl._request.return_value = "22"
    with pytest.raises(ValueError):
        rigctl.get_antenna()