review/messages.py @ 9030dc9517cf

web: add basic tests

This patch adds a new test module `test_web` to automate testing of web
requests. For now the tests are rather simple and only check for
expected status codes.

To set up the flask app within the tests, it has to be configured
properly. This is the reason why the app configuration part in `web.py`
has been moved into an own function - now it may also be used by the
test module.
author Oben Sonne <obensonne@googlemail.com>
date Mon, 02 Jul 2012 22:32:48 +0200
parents fcdbab575d22
children (none)
"""Messages used by the command-line UI of hg-review.

These are kept in a separate module to avoid repeating them over and over in
the cli module, and to make checking for proper output in the unit tests much
easier.

"""
NO_DATA_STORE = """\
the review data has not been initialized!
run "hg review --init" to do so
"""

INIT_START = """\
initializing the code review data store and config
"""

INIT_CLONE_MESSAGE = """\
initializing review data from %s
"""

INIT_SUCCESS_UNCOMMITTED = """\
the review data has been initialized
run "hg commit .hgreview -m 'initialize code review'" to record it permanently
"""

INIT_SUCCESS_CLONED = """\
the review data has been initialized
"""

INIT_REQUIRES_REMOTE_PATH ="""\
you must provide a remote path (see 'hg help review-init')!
"""

INIT_EXISTS = """\
the review data has already been initialized!
"""

INIT_EXISTS_UNCOMMITTED = """\
the review data has already been initialized, but is not recorded!
run "hg commit .hgreview -m 'initialize code review'" to record it permanently
"""

INIT_UNSUPPORTED_RELATIVE_RPATH = """\
relative remote paths are not supported (yet)!
"""

COMMENT_REQUIRES_MESSAGE = """\
empty comment
"""

COMMENT_FILE_DOES_NOT_EXIST = """\
file %s was not changed in revision %s!
"""

COMMENT_LINES_REQUIRE_FILE = """\
you must give a filename to comment on specific lines!
"""

COMMENT_EDITOR = """\


HG: Enter your comment. Lines beginning with 'HG:' are removed.
HG: Leave comment empty to abort comment.\
"""

COMMENT_EDITOR_MDOWN = """\


HG: Enter your comment. Lines beginning with 'HG:' are removed.
HG: This comment will be formatted with Markdown.
HG: Leave comment empty to abort comment.\
"""

SIGNOFF_REQUIRES_MESSAGE = """\
empty signoff message
"""

SIGNOFF_OPINION_CONFLICT = """\
cannot sign off as both --yes and --no!
"""

SIGNOFF_EXISTS = """\
you have already signed off on this changeset (use "hg review --edit" to modify)!
"""

SIGNOFF_EDITOR = """\


HG: Enter your signoff message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort signoff.\
"""

SIGNOFF_EDITOR_MDOWN = """\


HG: Enter your signoff message. Lines beginning with 'HG:' are removed.
HG: This message will be formatted with Markdown.
HG: Leave message empty to abort signoff.\
"""

REVIEW_LOG_CSET = """\
changeset: %d:%s
"""

REVIEW_LOG_AUTHOR = """\
author:    %s
"""

REVIEW_LOG_SUMMARY = """\
summary:   %s

"""

REVIEW_LOG_SIGNOFFS = """\
signoffs:  %d signoffs (%d yes, %d no, %d neutral)
"""

REVIEW_LOG_COMMENTS = """\
comments:  %d comments from %d authors
"""

REVIEW_LOG_COMMENT_AUTHOR = """# %s said:"""

REVIEW_LOG_COMMENT_LINE = """\
#     %s
"""

REVIEW_LOG_SIGNOFF_AUTHOR = """$ %s signed off as %s, saying:"""

REVIEW_LOG_SIGNOFF_LINE = """\
$     %s
"""

REVIEW_LOG_AGE = """(%s)"""
REVIEW_LOG_IDENTIFIER = """ (%s)"""
REVIEW_LOG_FILE_HEADER = """changes in %s"""

REVIEW_LOG_SKIPPED = """\
... skipped %d lines ...
"""

COMMIT_COMMENT = """Add a comment on changeset %s"""
DELETE_COMMENT = """Remove comment off from changeset %s"""
RENAME_COMMENT = """Rename comment on changeset %s"""

COMMIT_SIGNOFF = """Sign off on changeset %s"""
DELETE_SIGNOFF = """Remove signoff on changeset %s"""
RENAME_SIGNOFF = """Rename signoff on changeset %s"""

FETCH = """Automated merge of review data."""

WEB_START = """\
starting web server
"""

CHECK_SUCCESS = """\
changeset passed all tests
"""

CHECK_HAS_NOS = """\
changeset has a signoff of "no"
"""

CHECK_TOO_FEW_YESES = """\
changeset does not have enough signoffs of "yes"
"""

CHECK_UNSEEN = """\
changeset has no comments or signoffs
"""

AMBIGUOUS_ID = """\
the identifier '%s' matches more than one item!
"""

UNKNOWN_ID = """\
unknown item '%s'!
"""

REQUIRES_IDS = """\
no items specified
"""

EDIT_REQUIRES_SINGLE_ID = """\
cannot edit multiple items
"""

EDIT_REQUIRES_ONE_OR_LESS_FILES = """\
cannot edit a comment to be on multiple files
"""