Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_add(self):
with self.runner.isolated_filesystem():
dloc = '/cygdrive/c'+os.getcwd().replace('\\', '/')[2:] \
+ '/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_remove(self):
with self.runner.isolated_filesystem():
dloc = '/cygdrive/c'+os.getcwd().replace('\\', '/')[2:] \
+ '/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])
self.runner.invoke(cli, cmd + ['remove', 'foo', description])
for uda in uda_config_list:
tw.config.update({uda[0]: uda[1]})
assert len(tw.tasks.filter('Arena:foo')) == 0
def test_sync(self):
with self.runner.isolated_filesystem():
cwd = '/cygdrive/c'+os.getcwd().replace('\\', '/')[2:]
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_sync(self):
with self.runner.isolated_filesystem():
cwd = '/cygdrive/c'+os.getcwd().replace('\\', '/')[2:]
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 set_local_data(self, ldata):
if ldata:
self._local_data = ldata
self.tw_local = EnhancedTaskWarrior(
tlib.TaskWarrior(data_location=ldata),
self)
def set_remote_data(self, rdata):
if rdata:
self._remote_data = rdata
self.tw_remote = EnhancedTaskWarrior(
tlib.TaskWarrior(data_location=rdata),
self)