tests: Add bulk removal test for tags attribute

This commit is contained in:
Tomas Babej 2021-11-19 23:13:49 -05:00
parent af10774aec
commit 8074e509ba

View file

@ -36,13 +36,10 @@ from basetest import Task, TestCase
class TestTags(TestCase):
@classmethod
def setUpClass(cls):
"""Executed once before any test in the class"""
cls.t = Task()
def setUp(self):
"""Executed before each test in the class"""
self.t = Task()
def split_tags(self, tags):
return sorted(tags.strip().split(','))
@ -81,6 +78,19 @@ class TestTags(TestCase):
code, out, err = self.t("1 modify -missing")
self.assertIn("Modified 0 tasks", out)
def test_tag_bulk_removal(self):
"""2655: Test bulk removal of tags"""
self.t("add +one This +two is a test +three")
code, out, err = self.t("_get 1.tags")
self.assertEqual(
sorted(["one", "two", "three"]),
self.split_tags(out))
# Remove all tags in bulk
self.t("1 modify tags:")
code, out, err = self.t("_get 1.tags")
self.assertEqual("\n", out)
class TestVirtualTags(TestCase):
@classmethod