def test_config_excessive_migrate(): hide_user_config() copyfile(my_dir + "/datafiles/excessive_error.conf", config.Config.PATH) myconfig = config.Config() assert "this_should_not_be_here" not in myconfig assert "seek_distance" in myconfig restore_user_config()
def test_perspective_primary_input_keys(display): perspective = get_primary_perspective(display) display._footer_window.getch = mock.MagicMock(return_value=10) myconfig = config.Config() ret_val = perspective.handle_input(ord('q')) assert not ret_val display._stdscr.reset_mock() ret_val = perspective.handle_input(ord('h')) assert ret_val display._stdscr.timeout.assert_any_call(-1) display._stdscr.reset_mock() movement_keys = [ display.KEY_MAPPING[myconfig['key_up']], display.KEY_MAPPING[myconfig['key_right']], display.KEY_MAPPING[myconfig['key_down']], display.KEY_MAPPING[myconfig['key_left']], display.KEY_MAPPING[myconfig['key_scroll_up']], display.KEY_MAPPING[myconfig['key_scroll_down']], ] for key in movement_keys: perspective._metadata_updated = True ret_val = perspective.handle_input(key) assert ret_val assert not perspective._metadata_updated operation_keys = [ display.KEY_MAPPING[myconfig['key_add_feed']], display.KEY_MAPPING[myconfig['key_delete']], display.KEY_MAPPING[myconfig['key_reload']], display.KEY_MAPPING[myconfig['key_save']], display.KEY_MAPPING[myconfig['key_play_selected']], display.KEY_MAPPING[myconfig['key_add_selected']], display.KEY_MAPPING[myconfig['key_clear']], display.KEY_MAPPING[myconfig['key_next']], display.KEY_MAPPING[myconfig['key_invert']], display.KEY_MAPPING[myconfig['key_pause_play']], display.KEY_MAPPING[myconfig['key_pause_play_alt']], display.KEY_MAPPING[myconfig['key_seek_forward']], display.KEY_MAPPING[myconfig['key_seek_forward_alt']], display.KEY_MAPPING[myconfig['key_seek_backward']], display.KEY_MAPPING[myconfig['key_seek_backward_alt']], ] for key in operation_keys: ret_val = perspective.handle_input(key) assert ret_val
def test_config_iter(prevent_modification): myconfig = config.Config() for key in myconfig: assert key in myconfig
def test_config_length(prevent_modification): myconfig = config.Config() assert type(len(myconfig) == int) and len(myconfig) > 0
def test_config_excessive_migrate(prevent_modification): copyfile(my_dir + "/datafiles/excessive_error.conf", config.Config.PATH) myconfig = config.Config() assert "this_should_not_be_here" not in myconfig assert "seek_distance" in myconfig
def test_config_incomplete_migrate(prevent_modification): copyfile(my_dir + "/datafiles/incomplete_error.conf", config.Config.PATH) myconfig = config.Config() assert len(myconfig) > 0
def test_config_parse_error(prevent_modification): copyfile(my_dir + "/datafiles/parse_error.conf", config.Config.PATH) with pytest.raises(config.ConfigParseError): config.Config()
def test_config_parse_error(): hide_user_config() copyfile(my_dir + "/datafiles/parse_error.conf", config.Config.PATH) with pytest.raises(config.ConfigParseError): myconfig = config.Config() restore_user_config()
def test_config_del_item(prevent_modification): myconfig = config.Config() del myconfig["seek_distance"] assert "seek_distance" not in myconfig
def test_config_try_set_item(): hide_user_config() myconfig = config.Config() myconfig["fake"] = "value" restore_user_config() assert "fake" not in myconfig
def test_config_get_item(): hide_user_config() myconfig = config.Config() restore_user_config() seek_distance = myconfig["seek_distance"] assert seek_distance is not None
def test_config_iter(): hide_user_config() myconfig = config.Config() restore_user_config() for key in myconfig: assert key in myconfig
def test_config_length(): hide_user_config() myconfig = config.Config() restore_user_config() assert type(len(myconfig) == int) and len(myconfig) > 0
def test_config_incomplete_migrate(): hide_user_config() copyfile(my_dir + "/datafiles/incomplete_error.conf", config.Config.PATH) myconfig = config.Config() assert len(myconfig) > 0 restore_user_config()
def test_config_get_item(prevent_modification): myconfig = config.Config() seek_distance = myconfig["seek_distance"] assert seek_distance is not None
def test_config_try_set_item(prevent_modification): myconfig = config.Config() myconfig["fake"] = "value" assert "fake" not in myconfig
def test_config_del_item(): hide_user_config() myconfig = config.Config() restore_user_config() del myconfig["seek_distance"] assert "seek_distance" not in myconfig
def test_config_default(prevent_modification): myconfig = config.Config() assert isinstance(myconfig, config.Config)
def test_config_default(): hide_user_config() myconfig = config.Config() restore_user_config() assert isinstance(myconfig, config.Config)