def test_parse_username_unicode_handling(self): unparsed_strings = [u'sès', u'مو', u'èm'] expected_strings = ['S\xc3\xa8s', '\xd9\x85\xd9\x88', '\xc3\x88m'] for unparsed, expected in zip(unparsed_strings, expected_strings): username = parse_username(unparsed) assert_equal(username, expected)
def test_validate_username(self): # this username has a few problems that the normalize call should handle # 1. normal ascii space in front # 2. lowercase # 3. nasty trailing unicode space (the reason this file has coding:utf-8) problem_username = '******' parsed_user = parse_username(problem_username) assert_equal(parsed_user, 'Editor test-specific-0')