diff --git a/requirements.txt b/requirements.txt index a4de170cb..ba6741dc7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ PyYAML==3.10 texttable==0.8.1 # docker requires six==1.3.0 six==1.3.0 +mock==1.0.1 diff --git a/tests/cli_test.py b/tests/cli_test.py index 197046c11..f57553c59 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -1,6 +1,8 @@ from __future__ import unicode_literals from __future__ import absolute_import from . import unittest +from mock import patch +from six import StringIO from fig.cli.main import TopLevelCommand class CLITestCase(unittest.TestCase): @@ -15,8 +17,11 @@ class CLITestCase(unittest.TestCase): def test_help(self): self.assertRaises(SystemExit, lambda: self.command.dispatch(['-h'], None)) - def test_ps(self): + @patch('sys.stdout', new_callable=StringIO) + def test_ps(self, mock_stdout): + self.command.project.get_service('simple').create_container() self.command.dispatch(['ps'], None) + self.assertIn('fig_simple_1', mock_stdout.getvalue()) def test_scale(self): project = self.command.project