浏览代码

Updated cli_test.py to validate against the updated help command conditions

Signed-off-by: Tony Witherspoon <[email protected]>
Tony Witherspoon 9 年之前
父节点
当前提交
276738f733
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      tests/unit/cli_test.py

+ 7 - 0
tests/unit/cli_test.py

@@ -5,6 +5,7 @@ from __future__ import unicode_literals
 import os
 import shutil
 import tempfile
+from StringIO import StringIO
 
 import docker
 import py
@@ -82,6 +83,12 @@ class CLITestCase(unittest.TestCase):
         self.assertTrue(project.client)
         self.assertTrue(project.services)
 
+    def test_command_help(self):
+        with mock.patch('sys.stdout', new=StringIO()) as fake_stdout:
+            TopLevelCommand.help({'COMMAND': 'up'})
+
+        assert "Usage: up" in fake_stdout.getvalue()
+
     def test_command_help_nonexistent(self):
         with pytest.raises(NoSuchCommand):
             TopLevelCommand.help({'COMMAND': 'nonexistent'})