def check(lst): handler = AccViewerHandler() handler.start('h', 3, 4, 'm') handler.print_pages(lst) handler.end() output = self.read_output() return output
def test_will_replace_to_none_empty_user_name(self): i = [('a', 'b', None)] handler = AccViewerHandler() handler.start('h', 3, 4, 'm') handler.print_pages(i) handler.end() o = self.read_output() def match(s): res = ('1 a\n None at "b"' in s, ) return all(res) self.assertTrue(match(o), msg=(i, o))
def test_can_have_unicode_chars_in_message(self): i = 'm深' handler = AccViewerHandler() handler.start('h', 3, 4, i) handler.print_pages([('a', 'b', 'c')]) handler.end() o = self.read_output() def match(s): res = ('1 a\n "c" at "b"' in s, s.endswith(i + '\n')) return all(res) self.assertTrue(match(o), msg=(i, o))
def test_will_replace_to_unknown_empty_account_name(self): i = [(None, 'b', 'c')] handler = AccViewerHandler() handler.start('h', 3, 4, 'm') handler.print_pages(i) handler.end() o = self.read_output() def match(s): res = ('1 Unknown\n "c" at "b"' in s, ) return all(res) self.assertTrue(match(o), msg=(i, o))
def test_can_have_unicode_chars_in_header(self): i = 'h深' handler = AccViewerHandler() handler.start(i, 3, 4, 'm') handler.print_pages([('a', 'b', 'c')]) handler.end() o = self.read_output() def match(s): res = (s.startswith(i), '1 a\n "c" at "b"' in s) return all(res) self.assertTrue(match(o), msg=(i, o))