mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-18 15:33:08 +02:00
Refactor to store dependencies as individual attributes
This also drops support for the transitional `json.depends.array` configuration value, which has not been necessary since ~2016. As with tags, dependencies are stored in both a "combined", comma-separated format (for compatibility) and in an attribute-per-dependency format (for the future).
This commit is contained in:
parent
413b8d22b7
commit
20af583e21
10 changed files with 131 additions and 123 deletions
|
@ -146,7 +146,6 @@ class TestExportCommand(TestCase):
|
|||
self.t(('add', 'everything depends on me task'))
|
||||
self.t(('add', 'wrong, everything depends on me task'))
|
||||
self.t('1 modify depends:2,3')
|
||||
self.t.config('json.depends.array', 'on')
|
||||
|
||||
deps = self.export(1)['depends']
|
||||
self.assertType(deps, list)
|
||||
|
@ -155,19 +154,6 @@ class TestExportCommand(TestCase):
|
|||
for uuid in deps:
|
||||
self.assertString(uuid, UUID_REGEXP, regexp=True)
|
||||
|
||||
def test_export_depends_oldformat(self):
|
||||
self.t(('add', 'everything depends on me task'))
|
||||
self.t(('add', 'wrong, everything depends on me task'))
|
||||
self.t('1 modify depends:2,3')
|
||||
|
||||
code, out, err = self.t("rc.json.array=off rc.json.depends.array=off 1 export")
|
||||
deps = json.loads(out)["depends"]
|
||||
self.assertString(deps)
|
||||
self.assertEqual(len(deps.split(",")), 2)
|
||||
|
||||
for uuid in deps.split(','):
|
||||
self.assertString(uuid, UUID_REGEXP, regexp=True)
|
||||
|
||||
def test_export_urgency(self):
|
||||
self.t('add urgent task +urgent')
|
||||
|
||||
|
|
|
@ -187,15 +187,6 @@ class TestImport(TestCase):
|
|||
self.assertIn("Imported 3 tasks", err)
|
||||
self.assertData1()
|
||||
|
||||
def test_import_old_depend(self):
|
||||
"""One dependency used to be a plain string"""
|
||||
_data = """{"uuid":"a0000000-a000-a000-a000-a00000000000","depends":"a1111111-a111-a111-a111-a11111111111","description":"zero","project":"A","status":"pending","entry":"1234567889"}"""
|
||||
self.t("import", input=self.data1)
|
||||
self.t("import", input=_data)
|
||||
self.t.config("json.depends.array", "0")
|
||||
_t = self.t.export("a0000000-a000-a000-a000-a00000000000")[0]
|
||||
self.assertEqual(_t["depends"], "a1111111-a111-a111-a111-a11111111111")
|
||||
|
||||
def test_import_old_depends(self):
|
||||
"""Several dependencies used to be a comma seperated string"""
|
||||
_data = """{"uuid":"a0000000-a000-a000-a000-a00000000000","depends":"a1111111-a111-a111-a111-a11111111111,a2222222-a222-a222-a222-a22222222222","description":"zero","project":"A","status":"pending","entry":"1234567889"}"""
|
||||
|
@ -207,7 +198,6 @@ class TestImport(TestCase):
|
|||
|
||||
def test_import_new_depend(self):
|
||||
"""One dependency is a single array element"""
|
||||
self.t.config('json.depends.array', 'on')
|
||||
_data = """{"uuid":"a0000000-a000-a000-a000-a00000000000","depends":["a1111111-a111-a111-a111-a11111111111"],"description":"zero","project":"A","status":"pending","entry":"1234567889"}"""
|
||||
self.t("import", input=self.data1)
|
||||
self.t("import", input=_data)
|
||||
|
@ -216,7 +206,6 @@ class TestImport(TestCase):
|
|||
|
||||
def test_import_new_depends(self):
|
||||
"""Several dependencies are an array"""
|
||||
self.t.config('json.depends.array', 'on')
|
||||
_data = """{"uuid":"a0000000-a000-a000-a000-a00000000000","depends":["a1111111-a111-a111-a111-a11111111111","a2222222-a222-a222-a222-a22222222222"],"description":"zero","project":"A","status":"pending","entry":"1234567889"}"""
|
||||
self.t("import", input=self.data1)
|
||||
self.t("import", input=_data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue