Unittest - Refresh TW-1418 which still fails on \-

This commit is contained in:
Renato Alves 2014-10-20 20:04:59 +01:00
parent d09fcf398e
commit b569504139

View file

@ -8,7 +8,7 @@ import unittest
# Ensure python finds the local simpletap module
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task, TestCase, Taskd, ServerTestCase
from basetest import Task, TestCase
class Test1418(TestCase):
@ -16,101 +16,78 @@ class Test1418(TestCase):
self.t = Task()
# Helper methods
def find_in_list(self, description):
code, out, err = self.t(("list",))
self.assertIn(description, out)
def search_task_pattern(self, description):
# TODO escape any "/" in description - check comments on bug 1418
command = ("/" + description + "/",)
code, out, err = self.t(command)
self.assertIn(description, out)
# def search_task_bare(self, description):
# # TODO escape any "/" in description - check comments on bug 1418
# command = (description,)
# code, out, err = self.t(command)
# self.assertIn(description, out)
def add_search_task(self, description):
command = ("add", description)
code, out, err = self.t(command)
self.t(command)
def add_search_task_description(self, description):
command = ("add", "description:'" + description + "'")
code, out, err = self.t(command)
# Tests
# def test_slash_in_description_bare_words(self):
# """Check that you can search with a slash (/) and bare words"""
# description = "foo/"
# self.add_search_task(description)
# self.search_task_bare(description)
# def test_minus_in_description_bare_words(self):
# """Check that you can search with a minus (-) and bare words"""
# description = "foo-"
# self.add_search_task(description)
# self.search_task_bare(description)
# def test_plus_in_description_bare_words(self):
# """Check that you can search with a plus (+) and bare words"""
# description = "foo+"
# self.add_search_task(description)
# self.search_task_bare(description)
# def test_explicit_slash_in_description_bare_words(self):
# """Can add a task with trailing slash (/) using description:"" and bare
# words
# """
# description = "foo/"
# self.add_search_task_description(description)
# self.search_task_bare(description)
# def test_explicit_minus_in_description_bare_words(self):
# """Can add a task with trailing minus (-) using description:"" and bare
# words
# """
# description = "foo-"
# self.add_search_task_description(description)
# self.search_task_bare(description)
# def test_explicit_plus_in_description_bare_words(self):
# """Can add a task with trailing plus (+) using description:"" and bare
# words
# """
# description = "foo+"
# self.add_search_task_description(description)
# self.search_task_bare(description)
self.t(command)
def test_slash_in_description(self):
"""Check that you can search with a slash (/)"""
description = "foo\\/"
description = "foo/"
self.add_search_task(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_minus_in_description(self):
"""Check that you can search with a minus (-)"""
self.add_search_task("foo-")
self.search_task_pattern("foo\\-")
description = "foo-"
self.add_search_task(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_plus_in_description(self):
"""Check that you can search with a plus (+)"""
description = "foo\\+"
description = "foo+"
self.add_search_task(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_explicit_slash_in_description(self):
"""Can add a task with trailing slash (/) using description:"" """
description = "foo\\/"
description = "foo/"
self.add_search_task_description(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_explicit_minus_in_description(self):
"""Can add a task with trailing minus (-) using description:"" """
self.add_search_task_description("foo-")
self.search_task_pattern("foo\\-")
description = "foo-"
self.add_search_task_description(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_explicit_plus_in_description(self):
"""Can add a task with trailing plus (+) using description:"" """
description = "foo\\+"
description = "foo+"
self.add_search_task_description(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_slash_minus_in_description(self):
"""Can add and search a task with (\-) in description"""
description = "foo\-"
self.add_search_task(description)
self.find_in_list(description)
self.search_task_pattern(description)
def test_slash_plus_in_description(self):
"""Can add and search a task with (\+) in description"""
description = "foo\+"
self.add_search_task(description)
self.find_in_list(description)
self.search_task_pattern(description)