def test_log_d(self, mock): @log def dummy(): return [('FAIL', 'foo')] dummy() output = mock.getvalue() self.assertEqual(u'[ INFO ] \x1b[91mfoo\x1b[0m\n', output)
def test_log_h(self, mock): """ UnicodeError with umlauts """ @log def dummy(): return [('INFO', 'öf'.decode("windows-1252"))] dummy() output = mock.getvalue() self.assertEqual(u'[ INFO ] \x1b[94m\xc3\xb6f\x1b[0m\n', output)
def test_log_e(self, mock): """ We will just return, if there are no messages passed """ @log def dummy(): return [] dummy() output = mock.getvalue() self.assertEqual(u'', output)
def test_ListLine_a(self, mock): """ decorator returns nothing """ @ListLine def dummy(): return [] dummy() output = mock.getvalue() self.assertEqual(u'', output)
def test_ListLine_d(self, mock): """ decorator returns nothing """ @ListLine def dummy(): return { 'status': u'Clean', 'merge_status': u'', 'branch': u'master', 'pull_push': u'Up-to-date', 'dir_name': u'/srv/salt/base/tools', 'all_branches': u'issue_1, master, test1, test1_12345678'} dummy() output = mock.getvalue() self.assertEqual(u'\x1b[1G\x1b[93m/srv/salt/base/tools\x1b[0m\x1b[52G\x1b[92mmaster\x1b[0m\x1b[58G\x1b[91m\x1b[0m\x1b[68G\x1b[4mClean\x1b[0m\x1b[84G\x1b[92mUp-to-date\x1b[0m\x1b[100G\x1b[36missue_1, master, test1, test1_12345678\x1b[0m\n', output)