예제 #1
0
def test_scan():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    with pytest.raises(UnsupportedScanningConfigError):
        rr._scan("test", "test")
예제 #2
0
def test_error_clear_form():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    with pytest.raises(NotImplementedError):
        rr._clear_form(3)
예제 #3
0
def test_ok_is_valid_port():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    assert (is_valid_port("1025") == None)
    rr.root.destroy()
예제 #4
0
def test_load_conf16():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    assert (rr.params["cbb_mode1"].current() == 0)
    rr.root.destroy()
예제 #5
0
def test_load_conf14():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    assert (rr.params["ckb_auto_bookmark"].is_checked() == 0)
    rr.root.destroy()
예제 #6
0
def test_2_clear_form():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr._clear_form(2)
    assert (rr.params["txt_frequency2"].get() == "")
    assert (rr.params["txt_port2"].get() == "")
예제 #7
0
def test_load_conf7():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    assert (rr.params["txt_passes"].get() == "1")
    rr.root.destroy()
예제 #8
0
def test_store_conf(key, value):
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.ac.write_conf = MagicMock()
    out = store_conf(rr)
    assert(out.config[key] == value)
    rr.root.destroy()
예제 #9
0
def test_process_port_entry_2():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    rr._process_port_entry("8080", True)
    rr.rigctl.port = "8080"
    rr.root.destroy()
예제 #10
0
def test_process_hostname_entry(entry):
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    rr._process_hostname_entry(entry, True)
    rr.root.destroy()
    truncate_bookmark_file()
예제 #11
0
def test_center_window():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.ac.write_conf = MagicMock()
    panel = tk.Toplevel(rr)
    center_window(panel)
    assert(panel.geometry() == '1x1+533+284')
    rr.root.destroy()
예제 #12
0
def test_cb_add(entry, fake_control_source):
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    rr.params["txt_frequency1"].insert(0, entry)
    rr.cb_add(fake_control_source, True)
    rr.root.destroy()
    truncate_bookmark_file()
예제 #13
0
def test_load_conf17():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.apply_config(ac)
    assert (rr.params["cbb_mode1"].config()["values"][4] == ('', 'AM', 'FM',
                                                             'WFM', 'WFM_ST',
                                                             'LSB', 'USB',
                                                             'CW', 'CWL',
                                                             'CWU'))
    rr.root.destroy()
예제 #14
0
if __name__ == "__main__":

    args = input_arguments()
    logger = log_configuration(args.verbose)

    if args.alternate_prefix:
        dir_prefix = os.path.expanduser(args.alternate_prefix)
    else:
        dir_prefix = os.path.expanduser(DEFAULT_PREFIX)
    if args.alternate_config_file:
        config_file = process_path(args.alternate_config_file)
    else:
        config_file = os.path.join(dir_prefix, DEFAULT_CONFIG_FILENAME)

    root = tk.Tk()
    ac = AppConfig(config_file)
    # set bookmarks and log filename in this order:
    #   use command line alternate path
    #   use path from config file
    #   use default path
    if args.alternate_bookmark_file:
        ac.config['bookmark_filename'] = process_path(args.alternate_bookmark_file)
    elif ac.config['bookmark_filename'] == 'noname':
        ac.config['bookmark_filename'] = os.path.join(dir_prefix, DEFAULT_BOOKMARK_FILENAME)
    #set activity log filename
    if args.alternate_log_file:
        ac.config['log_filename'] = process_path(args.alternate_log_file)
    elif ac.config['log_filename'] == 'noname':
        ac.config['log_filename'] = os.path.join(dir_prefix, DEFAULT_LOG_FILENAME)
    app = RigRemote(root, ac)
    app.apply_config(ac)
예제 #15
0
def test_app_config5():
    ac = AppConfig("")
    assert (isinstance(ac.config, dict) == True)
예제 #16
0
def test_cb_get_frequency(fake_target):
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    rr.cb_get_frequency(fake_target)
예제 #17
0
def test_app_config8():
    ac = AppConfig(DEFAULT_CONFIG)
    assert (ac.config == {})
예제 #18
0
def test_app_config9():
    ac = AppConfig("./test-config.file")
    ac.read_conf()
    assert (ac.config["bookmark_filename"] ==
            "/home/marzona/.rig-remote/rig-remote-bookmarks.csv")
예제 #19
0
def test_new_activity_message():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    assert (rr._new_activity_message([]) == "")
예제 #20
0
def test_app_config6():
    ac = AppConfig(DEFAULT_CONFIG)
    assert (ac.config_file["bookmark_filename"] == None)
예제 #21
0
def test_popup_about():
    root = tk.Tk()
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    rr = RigRemote(root, ac)
    assert (rr.ckb_top.val.get() == False)
예제 #22
0
def test_app_config2():
    ac = AppConfig("test")
    assert (ac.config_file == "test")
예제 #23
0
def test_app_config4():
    ac = AppConfig("./test/test-config.file")
    ac.read_conf()
    assert (len(ac.config) == 19)
예제 #24
0
    args = input_arguments()
    logger = log_configuration(args.verbose)

    if args.alternate_prefix:
        prefix = args.alternate_prefix
        dir_prefix = os.path.expanduser(prefix)
    else:
        dir_prefix = DEFAULT_PREFIX
    if args.alternate_config_file:
        conf = args.alternate_config_file
        config_file = process_path(conf)
    else:
        config_file = os.path.join(dir_prefix, DEFAULT_CONFIG_FILENAME)

    root = tk.Tk()
    ac = AppConfig(config_file)
    # set bookmarks and log filename in this order:
    #   use command line alternate path
    #   use path from config file
    #   use default path
    ac.read_conf()

    if args.alternate_bookmark_file != None:
        bookmarks = args.alternate_bookmark_file
        ac.config['bookmark_filename'] = process_path(bookmarks)
    elif ac.config["bookmark_filename"] == None:
        ac.config["bookmark_filename"] = os.path.join(dir_prefix, DEFAULT_BOOKMARK_FILENAME)
    # set activity log filename
    if args.alternate_log_file != None:
        log = args.alternate_log_file
        ac.config['log_filename'] = process_path(log)
예제 #25
0
def test_app_config4():
    ac = AppConfig("/tmp/test")
    ac.read_conf()
    assert(len(ac.config) == 16)