review/tests/test_init.py @ 0071e116bfb4
Clean up the helptable entries a bit.
| author | Steve Losh <steve@stevelosh.com> |
|---|---|
| date | Sun, 11 Oct 2009 11:19:12 -0400 |
| parents | 4ede1c231525 |
| children | 65a39843de8d |
from nose import * from util import * from .. import messages from .. import api import os from mercurial import util as hgutil @with_setup(setup_sandbox, teardown_sandbox) def test_init(): sandbox = get_sandbox_repo() output = review(init=True, remote_path='../sandbox-review') assert messages.INIT_SUCCESS in output assert '.hgreview' not in sandbox['tip'] assert os.path.exists('.hgreview') assert os.path.isdir(api.DEFAULT_DATASTORE_DIRNAME) assert get_datastore_repo(api.DEFAULT_DATASTORE_DIRNAME) with open('.hgreview', 'r') as hgrf: hgr = hgrf.read() assert 'local = %s' % api.DEFAULT_DATASTORE_DIRNAME in hgr assert 'remote = ../sandbox-review' in hgr @with_setup(setup_sandbox, teardown_sandbox) def test_init_with_local_path(): sandbox = get_sandbox_repo() output = review(init=True, local_path='NEW', remote_path='../sandbox-review') assert messages.INIT_SUCCESS in output assert '.hgreview' not in sandbox['tip'] assert os.path.exists('.hgreview') assert os.path.isdir('NEW') assert get_datastore_repo('NEW') with open('.hgreview', 'r') as hgrf: hgr = hgrf.read() assert 'local = NEW' in hgr assert 'remote = ../sandbox-review' in hgr @with_setup(setup_sandbox, teardown_sandbox) def test_init_without_remote_path(): sandbox = get_sandbox_repo() try: review(init=True) except hgutil.Abort, e: error = str(e) assert messages.INIT_REQUIRES_REMOTE_PATH in error else: assert False, 'The correct error message was not printed.' @with_setup(setup_sandbox, teardown_sandbox) def test_init_twice(): sandbox = get_sandbox_repo() review(init=True, remote_path='../sandbox-review') try: review(init=True, remote_path='../sandbox-review') except hgutil.Abort, e: error = str(e) assert messages.INIT_EXISTS_UNCOMMITTED in error else: assert False, 'The correct error message was not printed.'