def test_load_conf17(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["cbb_mode"].config()["values"][4] == ('', 'OFF', 'RAW', 'AM', 'FM', 'WFM', 'WFM_ST', 'LSB', 'USB', 'CW', 'CWL', 'CWU')) rr.root.destroy()
def test_load_conf16(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["cbb_mode"].current() == 0) rr.root.destroy()
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)
def test_load_conf1(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["txt_hostname"].get() == "127.0.0.1") rr.root.destroy()
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")
def test_load_conf4(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["txt_range_min"].get() == "159,000") rr.root.destroy()
def test_processs_hostname_entry(entry): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) rr._process_hostname_entry(entry, True) rr.root.destroy()
def test_load_conf6(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["txt_interval"].get() == "100") rr.root.destroy()
def test_load_conf9(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["txt_frequency"].get() == "") rr.root.destroy()
def test_load_conf10(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert(rr.params["ckb_wait"].is_checked() == 0) rr.root.destroy()
def test_load_conf11(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) assert (rr.params["txt_sgn_level"].get() == "-40") rr.root.destroy()
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()
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() == "")
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()
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()
def test_cb_add(entry): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) rr.params["txt_frequency"].insert(0, entry) rr.cb_add(True) rr.root.destroy()
def test_processs_port_entry_2(): root = tk.Tk() ac = AppConfig("./test/test-config.file") rr = RigRemote(root, ac) rr.apply_config(ac) rr._process_port_entry("8080", True) rr.rigctl.port="8080" rr.root.destroy()
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()
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()
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()
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()
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()
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()
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()
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) app.mainloop() if app.scan_thread != None : app.scanning.terminate()
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)
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([]) == "")
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)
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) else: ac.config['log_filename'] = os.path.join(dir_prefix, DEFAULT_LOG_FILENAME) app = RigRemote(root, ac) app.apply_config(ac) app.mainloop() if app.scan_thread != None : app.scanning.terminate()