review/tests/test_encoding.py @ 354188b0eca0
Allow signoff to be added when one already exists on a precursor. The current obsolescence support makes little difference between comments/signoff from a cset and the ones from its predecessors. This patch avoid a signoff from a precursor to be seen as changeable, and allow the user to re-signoff on the latest version of the changeset.
| author | Christophe de Vienne <cdevienne@gmail.com> |
|---|---|
| date | Wed, 29 Oct 2014 14:32:27 +0100 |
| parents | cada9aab8b6f |
| children | (none) |
# coding=utf-8 # import os import unicodedata from nose import with_setup from util import setup_reviewed_sandbox, teardown_sandbox, review, should_fail_with from util import get_datastore_repo, get_sandbox_repo, get_ui from util import check_comment_exists_on_line from .. import api, messages, rutil from mercurial.node import hex @with_setup(setup_reviewed_sandbox(), teardown_sandbox) def test_comment_encoding(): review(comment=True, message=rutil.tolocal(u'Téstíng.')) output = review() assert messages.REVIEW_LOG_COMMENT_LINE % rutil.tolocal(u'Téstíng.') in output @with_setup(setup_reviewed_sandbox(), teardown_sandbox) def test_signoff_encoding(): review(signoff=True, message=rutil.tolocal(u'Téstíng.')) output = review() assert messages.REVIEW_LOG_SIGNOFF_LINE % rutil.tolocal(u'Téstíng.') in output @with_setup(setup_reviewed_sandbox(username=u'Tést <tést@test.com>', encoding='UTF-8'), teardown_sandbox) def test_username_encoding_utf8(): review(comment=True, message=rutil.tolocal(u'Cómment.')) output = review() assert u'Tést'.encode('UTF-8') in output assert u'Cómment.'.encode('UTF-8') in output @with_setup(setup_reviewed_sandbox(username=u'Tést <tést@test.com>', encoding='ISO-8859-1'), teardown_sandbox) def test_username_encoding_iso_8859_1(): review(comment=True, message=rutil.tolocal(u'Cómment.')) output = review() assert u'Tést'.encode('ISO-8859-1') in output assert u'Cómment.'.encode('ISO-8859-1') in output @with_setup(setup_reviewed_sandbox(username=u'Tést <tést@test.com>', encoding='UTF-8', file_encoding='UTF-8'), teardown_sandbox) def test_file_encoding_utf8(): review(comment=True, message=rutil.tolocal(u'Cómment.'), rev='1') output = review(rev='1') normal_output = unicodedata.normalize('NFC', output.decode('UTF-8')) assert unicodedata.normalize('NFC', u'filé') in normal_output assert u'Tést'.encode('UTF-8') in output assert u'Cómment.'.encode('UTF-8') in output assert u'-oné'.encode('UTF-8') in output assert u'+óne'.encode('UTF-8') in output assert u'-twó'.encode('UTF-8') in output assert u'+two'.encode('UTF-8') in output assert u'-thrée'.encode('UTF-8') in output assert u'+threé'.encode('UTF-8') in output @with_setup(setup_reviewed_sandbox(username=u'Tést <tést@test.com>', encoding='latin-1', file_encoding='latin-1'), teardown_sandbox) def test_file_encoding_iso88591(): review(comment=True, message=rutil.tolocal(u'Cómment.'), rev='1') output = review(rev='1') # TODO: Make this work. #normal_output = unicodedata.normalize('NFC', output.decode('latin-1')) #assert unicodedata.normalize('NFC', u'filé') in normal_output assert u'Tést'.encode('latin-1') in output assert u'Cómment.'.encode('latin-1') in output assert u'-oné'.encode('latin-1') in output assert u'+óne'.encode('latin-1') in output assert u'-twó'.encode('latin-1') in output assert u'+two'.encode('latin-1') in output assert u'-thrée'.encode('latin-1') in output assert u'+threé'.encode('latin-1') in output