e72a3408cc68

Add stdout checks to the test suite.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 04 Oct 2009 19:09:55 -0400
parents e92ab6fb652e
children 94b4bdc4a60c
branches/tags (none)
files review/tests/test_init.py review/tests/util.py

Changes

--- a/review/tests/test_init.py	Sun Oct 04 19:01:57 2009 -0400
+++ b/review/tests/test_init.py	Sun Oct 04 19:09:55 2009 -0400
@@ -2,13 +2,18 @@
 from util import *
 
 import os
+from .. import messages
 
 
 @with_setup(setup_sandbox, teardown_sandbox)
 def test_init():
     sandbox = get_sandbox_repo()
     
+    gather_output()
     review(init=True)
+    output = grab_output()
+    
+    assert messages.INIT_SUCCESS in output
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
@@ -25,7 +30,11 @@
 def test_init_with_local_path():
     sandbox = get_sandbox_repo()
     
+    gather_output()
     review(init=True, local_path='codereview')
+    output = grab_output()
+    
+    assert messages.INIT_SUCCESS in output
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
@@ -42,7 +51,11 @@
 def test_init_with_remote_path():
     sandbox = get_sandbox_repo()
     
+    gather_output()
     review(init=True, remote_path='../code-review')
+    output = grab_output()
+    
+    assert messages.INIT_SUCCESS in output
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
@@ -59,7 +72,11 @@
 def test_init_with_both_paths():
     sandbox = get_sandbox_repo()
     
+    gather_output()
     review(init=True, local_path='codereview', remote_path='../code-review')
+    output = grab_output()
+    
+    assert messages.INIT_SUCCESS in output
     
     assert '.hgreview' not in sandbox['tip']
     assert os.path.exists('.hgreview')
--- a/review/tests/util.py	Sun Oct 04 19:01:57 2009 -0400
+++ b/review/tests/util.py	Sun Oct 04 19:09:55 2009 -0400
@@ -37,3 +37,9 @@
 
 def get_datastore_repo(path):
     return hg.repository(_ui, path)
+
+def gather_output():
+    _ui.pushbuffer()
+
+def grab_output():
+    return _ui.popbuffer()