mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Tests: Implement export() for task access
This commit is contained in:
parent
916ca29507
commit
9e20f83f24
1 changed files with 11 additions and 0 deletions
|
@ -5,6 +5,7 @@ import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import atexit
|
import atexit
|
||||||
import unittest
|
import unittest
|
||||||
|
import json
|
||||||
from .utils import (run_cmd_wait, run_cmd_wait_nofail, which,
|
from .utils import (run_cmd_wait, run_cmd_wait_nofail, which,
|
||||||
task_binary_location)
|
task_binary_location)
|
||||||
from .exceptions import CommandError
|
from .exceptions import CommandError
|
||||||
|
@ -146,6 +147,16 @@ class Task(object):
|
||||||
with open(self.taskrc, "r") as f:
|
with open(self.taskrc, "r") as f:
|
||||||
return f.readlines()
|
return f.readlines()
|
||||||
|
|
||||||
|
def export(self, export_filter=None):
|
||||||
|
"""Run "task export", return JSON array of exported tasks."""
|
||||||
|
if export_filter is None:
|
||||||
|
export_filter = ""
|
||||||
|
|
||||||
|
code, out, err = self.runSuccess("rc.json.array=1 {0} export"
|
||||||
|
"".format(export_filter))
|
||||||
|
|
||||||
|
return json.loads(out)
|
||||||
|
|
||||||
def runSuccess(self, args=(), input=None, merge_streams=False,
|
def runSuccess(self, args=(), input=None, merge_streams=False,
|
||||||
timeout=5):
|
timeout=5):
|
||||||
"""Invoke task with given arguments and fail if exit code != 0
|
"""Invoke task with given arguments and fail if exit code != 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue