Extend command 'annotate' to remove annotation

- Closes #247

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2019-08-24 23:56:33 +02:00
parent 99c3398a63
commit e6b5a14927
3 changed files with 16 additions and 10 deletions

View file

@ -91,16 +91,19 @@ class TestAnnotate(TestCase):
self.assertIn("At least one ID must be specified.", err)
def test_should_fail_on_no_annotation(self):
"""Calling command 'annotate' without annotation is an error"""
def test_remove_annotation_from_interval(self):
"""Calling 'annotate' without annotation removes annotation"""
now_utc = datetime.now().utcnow()
one_hour_before_utc = now_utc - timedelta(hours=1)
self.t("track {:%Y-%m-%dT%H:%M:%S}Z - {:%Y-%m-%dT%H:%M:%S}Z".format(one_hour_before_utc, now_utc))
code, out, err = self.t.runError("annotate @1")
code, out, err = self.t("annotate @1")
self.assertIn("No annotation string given.", err)
self.assertIn("Removed annotation from @1", out)
j = self.t.export()
self.assertClosedInterval(j[0], expectedAnnotation="")
def test_add_annotation_to_closed_interval(self):
"""Add an annotation to a closed interval"""