Improve ps CLI test
This commit is contained in:
parent
855a9c623c
commit
7abc4fbf3a
2 changed files with 7 additions and 1 deletions
|
|
@ -5,3 +5,4 @@ PyYAML==3.10
|
||||||
texttable==0.8.1
|
texttable==0.8.1
|
||||||
# docker requires six==1.3.0
|
# docker requires six==1.3.0
|
||||||
six==1.3.0
|
six==1.3.0
|
||||||
|
mock==1.0.1
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from . import unittest
|
from . import unittest
|
||||||
|
from mock import patch
|
||||||
|
from six import StringIO
|
||||||
from fig.cli.main import TopLevelCommand
|
from fig.cli.main import TopLevelCommand
|
||||||
|
|
||||||
class CLITestCase(unittest.TestCase):
|
class CLITestCase(unittest.TestCase):
|
||||||
|
|
@ -15,8 +17,11 @@ class CLITestCase(unittest.TestCase):
|
||||||
def test_help(self):
|
def test_help(self):
|
||||||
self.assertRaises(SystemExit, lambda: self.command.dispatch(['-h'], None))
|
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.command.dispatch(['ps'], None)
|
||||||
|
self.assertIn('fig_simple_1', mock_stdout.getvalue())
|
||||||
|
|
||||||
def test_scale(self):
|
def test_scale(self):
|
||||||
project = self.command.project
|
project = self.command.project
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue