review/tests/test_comment.py @ 22d5187cb76e
Big API changes.
author |
Steve Losh <steve@stevelosh.com> |
date |
Sun, 04 Oct 2009 20:19:32 -0400 |
parents |
ac51c0878e04 |
children |
12aeab05829a |
from nose import *
from util import *
import os
from .. import messages
from mercurial import util as hgutil
@with_setup(setup_reviewed_sandbox, teardown_sandbox)
def test_no_comments():
sandbox = get_sandbox_repo()
gather_output()
review()
output = grab_output()
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.')
gather_output()
review()
output = grab_output()
assert messages.REVIEW_LOG_COMMENTS % (1, 1) in output
review(comment=True, message='Test comment two.')
gather_output()
review()
output = grab_output()
assert messages.REVIEW_LOG_COMMENTS % (2, 1) 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')
gather_output()
review(rev='0')
output = grab_output()
assert messages.REVIEW_LOG_COMMENTS % (1, 1) in output
gather_output()
review()
output = grab_output()
assert messages.REVIEW_LOG_COMMENTS % (0, 0) in output
review(comment=True, message='Test comment two.', rev='0')
gather_output()
review(rev='0')
output = grab_output()
assert messages.REVIEW_LOG_COMMENTS % (2, 1) in output