bc3aa7a206f0

Add signoff tests.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 04 Oct 2009 20:47:20 -0400
parents 808aaa1eef26
children e91ac244e5ad
branches/tags (none)
files review/tests/test_signoff.py

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/tests/test_signoff.py	Sun Oct 04 20:47:20 2009 -0400
@@ -0,0 +1,59 @@
+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_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.')
+    
+    gather_output()
+    review()
+    output = grab_output()
+    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')
+    
+    gather_output()
+    review(rev='0')
+    output = grab_output()
+    assert messages.REVIEW_LOG_SIGNOFFS % 1 in output
+    
+    gather_output()
+    review()
+    output = grab_output()
+    assert messages.REVIEW_LOG_SIGNOFFS % 0 in output
+