Improve ps CLI test

This commit is contained in:
Ben Firshman 2014-01-20 16:50:41 +00:00
parent 855a9c623c
commit 7abc4fbf3a
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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