From 276738f733c3512b939168c1475a6085a9482c6a Mon Sep 17 00:00:00 2001 From: Tony Witherspoon Date: Tue, 12 Apr 2016 11:47:15 -0400 Subject: [PATCH] Updated cli_test.py to validate against the updated help command conditions Signed-off-by: Tony Witherspoon --- tests/unit/cli_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/cli_test.py b/tests/unit/cli_test.py index 182e79ed5..9700d5927 100644 --- a/tests/unit/cli_test.py +++ b/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'})