def test_remove_last(cleandir, funk_dict, fake_db): """Tests that local funk database is removed when last funk is removed.""" assert os.path.isfile(commands.Command.FUNKY_DB_FILENAME) for funk in funk_dict: remove_cmd = commands.Remove(funk) remove_cmd() assert not os.path.isfile(commands.Command.FUNKY_DB_FILENAME)
def test_remove_all(getch, y_or_n, cleandir, fake_db): """Tests that the local funk database is removed when no funk is provided and the user confirms. """ getch.side_effect = lambda x: y_or_n assert os.path.isfile(commands.Command.FUNKY_DB_FILENAME) remove_cmd = commands.Remove(None) remove_cmd() isfile = os.path.isfile(commands.Command.FUNKY_DB_FILENAME) if y_or_n == 'y': expected = not isfile else: expected = isfile assert expected
def remove_cmd(args): """Builds and returns 'remove' command.""" cmd = commands.Remove(args.args, color=args.color) return cmd