review/tests/test_comment.py @ 7e437c5261bb
Output diffs (with line numbers) and review-level comments for review. Parsing and formatting unified diffs is hard, let's ride bikes^H^H^H^H^H^H^H^H^H^H^H drink beer!
| author | Steve Losh <steve@stevelosh.com> |
|---|---|
| date | Mon, 05 Oct 2009 19:45:45 -0400 |
| parents | 6d90ef243069 |
| children | 1ef154bb1a4f |
from nose import * from util import * from .. import messages import os from mercurial import util as hgutil @with_setup(setup_reviewed_sandbox, teardown_sandbox) def test_no_comments(): sandbox = get_sandbox_repo() output = review() assert messages.REVIEW_LOG_COMMENTS % (0, 0) in output @with_setup(setup_reviewed_sandbox, teardown_sandbox) def test_blank_comment(): sandbox = get_sandbox_repo() try: review(comment=True) except hgutil.Abort, e: error = str(e) assert messages.COMMENT_REQUIRES_MESSAGE in error else: assert False, 'The correct error message was not printed.' @with_setup(setup_reviewed_sandbox, teardown_sandbox) def test_add_comments_to_parent_rev(): sandbox = get_sandbox_repo() review(comment=True, message='Test comment one.') output = review() assert messages.REVIEW_LOG_COMMENTS % (1, 1) in output author_line = messages.REVIEW_LOG_COMMENT_AUTHOR % '|' a1, _, a2 = author_line.partition('|') assert a1 in output assert a2 in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output review(comment=True, message='Test comment two.') output = review() assert messages.REVIEW_LOG_COMMENTS % (2, 1) in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment two.' in output @with_setup(setup_reviewed_sandbox, teardown_sandbox) def test_add_comments_to_specific_rev(): sandbox = get_sandbox_repo() review(comment=True, message='Test comment one.', rev='0') output = review(rev='0') assert messages.REVIEW_LOG_COMMENTS % (1, 1) in output author_line = messages.REVIEW_LOG_COMMENT_AUTHOR % '|' a1, _, a2 = author_line.partition('|') assert a1 in output assert a2 in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output output = review() assert messages.REVIEW_LOG_COMMENTS % (0, 0) in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' not in output review(comment=True, message='Test comment two.', rev='0') output = review(rev='0') assert messages.REVIEW_LOG_COMMENTS % (2, 1) in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment one.' in output assert messages.REVIEW_LOG_COMMENT_LINE % 'Test comment two.' in output