Fixed job redaction for projects and unit tests

This commit is contained in:
Matthew Jones
2015-08-31 16:24:38 -04:00
parent bd3faea671
commit 09f4c9fbbe
4 changed files with 57 additions and 18 deletions

View File

@@ -623,7 +623,7 @@ class BaseTestMixin(QueueTestMixin, MockCommonlySlowTestMixin):
msg += '"%s" found in: "%s"' % (substr, string)
self.assertEqual(count, 0, msg)
def check_found(self, string, substr, count, description=None, word_boundary=False):
def check_found(self, string, substr, count=-1, description=None, word_boundary=False):
if word_boundary:
count_actual = len(re.findall(r'\b%s\b' % re.escape(substr), string))
else:
@@ -632,8 +632,11 @@ class BaseTestMixin(QueueTestMixin, MockCommonlySlowTestMixin):
msg = ''
if description:
msg = 'Test "%s".\n' % description
msg += 'Found %d occurances of "%s" instead of %d in: "%s"' % (count_actual, substr, count, string)
self.assertEqual(count_actual, count, msg)
if count == -1:
self.assertTrue(count_actual > 0)
else:
msg += 'Found %d occurances of "%s" instead of %d in: "%s"' % (count_actual, substr, count, string)
self.assertEqual(count_actual, count, msg)
def check_job_result(self, job, expected='successful', expect_stdout=True,
expect_traceback=False):