review/tests/test_signoff.py @ 1ef154bb1a4f
Add file-level commenting.
author |
Steve Losh <steve@stevelosh.com> |
date |
Mon, 05 Oct 2009 20:50:06 -0400 |
parents |
6d90ef243069 |
children |
ab4cc556087d |
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_SIGNOFFS % 0 in output
@with_setup(setup_reviewed_sandbox, teardown_sandbox)
def test_blank_signoff():
sandbox = get_sandbox_repo()
try:
review(signoff=True)
except hgutil.Abort, e:
error = str(e)
assert messages.SIGNOFF_REQUIRES_MESSAGE in error
else:
assert False, 'The correct error message was not printed.'
@with_setup(setup_reviewed_sandbox, teardown_sandbox)
def test_signoff_on_parent_rev():
sandbox = get_sandbox_repo()
review(signoff=True, message='Test signoff one.')
output = review()
assert messages.REVIEW_LOG_SIGNOFFS % 1 in output
@with_setup(setup_reviewed_sandbox, teardown_sandbox)
def test_signoff_on_specific_rev():
sandbox = get_sandbox_repo()
review(signoff=True, message='Test signoff one.', rev='0')
output = review(rev='0')
assert messages.REVIEW_LOG_SIGNOFFS % 1 in output
output = review()
assert messages.REVIEW_LOG_SIGNOFFS % 0 in output
@with_setup(setup_reviewed_sandbox, teardown_sandbox)
def test_multiple_signoffs():
sandbox = get_sandbox_repo()
review(signoff=True, message='Test signoff one.')
try:
review(signoff=True, message='Test signoff two.')
except hgutil.Abort, e:
error = str(e)
assert messages.SIGNOFF_EXISTS in error
else:
assert False, 'The correct error message was not printed.'
review(signoff=True, message='Test signoff two.', force=True)
output = review()
assert messages.REVIEW_LOG_SIGNOFFS % 1 in output