mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 22:33:08 +02:00
Test: Verify that invalid UUIDs are not accepted
This commit is contained in:
parent
3e7c9157a1
commit
2a6a40d97b
1 changed files with 17 additions and 0 deletions
|
@ -262,6 +262,23 @@ class TestImportExportRoundtrip(TestCase):
|
||||||
self._validate_data(self.t2)
|
self._validate_data(self.t2)
|
||||||
|
|
||||||
|
|
||||||
|
class TestImportValidate(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.t = Task()
|
||||||
|
|
||||||
|
def test_import_empty_json(self):
|
||||||
|
"""Verify empty JSON is caught"""
|
||||||
|
j = '{}'
|
||||||
|
code, out, err = self.t.runError("import", input=j)
|
||||||
|
self.assertIn("A task must have a description.", err)
|
||||||
|
|
||||||
|
def test_import_invalid_uuid(self):
|
||||||
|
"""Verify invalid UUID is caught"""
|
||||||
|
j = '{"uuid":"1", "description":"bad"}'
|
||||||
|
code, out, err = self.t.runError("import", input=j)
|
||||||
|
self.assertIn("Not a valid UUID", err)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from simpletap import TAPTestRunner
|
from simpletap import TAPTestRunner
|
||||||
unittest.main(testRunner=TAPTestRunner())
|
unittest.main(testRunner=TAPTestRunner())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue