def todo(self): nextTask = self.prompt(self.tw.tasks.pending().filter('+todo')) if isinstance(nextTask, str): task = Task(self.tw, description=nextTask, tags=['todo']) task.save() else: nextTask['tags'].remove('todo') nextTask.save() self.change(nextTask)
def test_add(self): with self.runner.isolated_filesystem(): dloc = os.getcwd() + '/local' tw = TaskWarrior(dloc) t = Task(tw) description = 'do dishes' t['description'] = description t.save() self.runner.invoke(cli, cmd_dummy_arena) self.runner.invoke(cli, cmd + ['add', 'foo', description]) for uda in uda_config_list: tw.config.update({uda[0]: uda[1]}) assert len(tw.tasks.filter('Arena:foo')) == 1
def test_add(self): with self.runner.isolated_filesystem(): dloc = os.getcwd() + '/local' tw = TaskWarrior(dloc) t = Task(tw) description = 'do dishes' t['description'] = description t.save() self.runner.invoke(cli, cmd_dummy_arena) self.runner.invoke(cli, cmd + ['add', 'foo', description]) for uda in uda_config_list: tw.config.update({uda[0]: uda[1]}) assert len(tw.tasks.filter('Arena:foo')) == 1
def test_local(self): with self.runner.isolated_filesystem(): dloc = os.getcwd() + '/local' tw = TaskWarrior(dloc) t = Task(tw) description = 'do dishes' t['description'] = description t.save() self.runner.invoke(cli, cmd_dummy_arena) self.runner.invoke(cli, cmd + ['add', 'foo', description]) for uda in uda_config_list: tw.config.update({uda[0]: uda[1]}) result = self.runner.invoke(cli, cmd + ['local', 'foo', 'dishes']) assert 'dishes' in result.output
def test_local(self): with self.runner.isolated_filesystem(): dloc = os.getcwd() + '/local' tw = TaskWarrior(dloc) t = Task(tw) description = 'do dishes' t['description'] = description t.save() self.runner.invoke(cli, cmd_dummy_arena) self.runner.invoke(cli, cmd + ['add', 'foo', description]) for uda in uda_config_list: tw.config.update({uda[0]: uda[1]}) result = self.runner.invoke(cli, cmd + ['local', 'foo', 'dishes']) assert 'dishes' in result.output
def test_sync(self): with self.runner.isolated_filesystem(): cwd = os.getcwd() dloc = cwd + '/local' dremote = cwd + '/remote' tw_local = TaskWarrior(dloc) tw_remote = TaskWarrior(dremote) t = Task(tw_local) description = 'do dishes' t['description'] = description t.save() self.runner.invoke(cli, cmd_dummy_arena) self.runner.invoke(cli, cmd + ['add', 'foo', description]) result = self.runner.invoke(cli, cmd + ['sync', 'foo'], input='a\n') assert len(tw_remote.tasks.filter()) == 1
def test_remote(self): with self.runner.isolated_filesystem(): self.runner.invoke(cli, cmd_dummy_arena) dloc = os.getcwd() + '/remote' tw = TaskWarrior(dloc) for uda in uda_config_list: tw.config.update({uda[0]: uda[1]}) t = Task(tw) description = 'do dishes' t['description'] = description t['Arena'] = 'foo' t['ArenaTaskID'] = '1' t.save() result = self.runner.invoke(cli, cmd + ['remote', 'foo', 'dishes']) assert 'dishes' in result.output
def test_remote(self): with self.runner.isolated_filesystem(): self.runner.invoke(cli, cmd_dummy_arena) dloc = os.getcwd() + '/remote' tw = TaskWarrior(dloc) for uda in uda_config_list: tw.config.update({uda[0]: uda[1]}) t = Task(tw) description = 'do dishes' t['description'] = description t['Arena'] = 'foo' t['ArenaTaskID'] = '1' t.save() result = self.runner.invoke(cli, cmd + ['remote', 'foo', 'dishes']) assert 'dishes' in result.output
def test_sync(self): with self.runner.isolated_filesystem(): cwd = os.getcwd() dloc = cwd + '/local' dremote = cwd + '/remote' tw_local = TaskWarrior(dloc) tw_remote = TaskWarrior(dremote) t = Task(tw_local) description = 'do dishes' t['description'] = description t.save() self.runner.invoke(cli, cmd_dummy_arena) self.runner.invoke(cli, cmd + ['add', 'foo', description]) result = self.runner.invoke(cli, cmd + ['sync', 'foo'], input='a\n') assert len(tw_remote.tasks.filter()) == 1
def download_trello_card(project_name, list_name, trello_card, task_warrior, doing_list_name, done_list_name): """Download all contents of Trello card, creating new Taskwarrior task :project_name: the name of project where the card is stored :list_name: the name of list where the card is stored :trello_card: a Trello Card object :task_warrior: Taskwarrior object :doing_list_name: name of doing list to set task active :done_list_name: name of done list to set task done """ new_tw_task = Task(task_warrior) new_tw_task['project'] = project_name new_tw_task['description'] = trello_card.name if trello_card.due_date: new_tw_task['due'] = trello_card.due_date new_tw_task['trelloid'] = trello_card.id new_tw_task['trellolistname'] = list_name new_tw_task.save() if list_name == doing_list_name: new_tw_task.start() if list_name == done_list_name: new_tw_task.done()
def download_trello_card(project_name, list_name, trello_card, task_warrior, doing_list_name, done_list_name): """ Download all contens of trello card creating new Task Warrior task :project_name: the name of project where the card is stored :list_name: the name of list where the card is stored :trello_card: a Trello Card object :task_warrior: Task Warrior object :doing_list_name: name of doing list to set task active :done_list_name: name of done list to set task done """ new_tw_task = Task(task_warrior) new_tw_task['project'] = project_name new_tw_task['description'] = trello_card.name if trello_card.due_date: new_tw_task['due'] = trello_card.due_date new_tw_task['trelloid'] = trello_card.id new_tw_task['trellolistname'] = list_name new_tw_task.save() if list_name == doing_list_name: new_tw_task.start() if list_name == done_list_name: new_tw_task.done()
def pause(self, restart=True): active = self.current() if not active: return if active['description'] == self.PAUSED: prev = self.tw.tasks.pending().get(tags__contains = [self.PAUSED]) active.stop() prev['tags'].remove(self.PAUSED) prev.save() if restart: prev.start() else: pause_task = self.tw.tasks.pending().filter(description = self.PAUSED) if not pause_task: pause_task = Task(self.tw, description=self.PAUSED) pause_task.save() else: pause_task = pause_task.get() active.stop() active['tags'].add(self.PAUSED) active.save() pause_task.start()