diff options
author | d11wtq <chris@w3style.co.uk> | 2014-06-08 13:03:58 +0000 |
---|---|---|
committer | Chris Corbyn <chris@w3style.co.uk> | 2014-06-09 01:31:49 +0000 |
commit | 655d347ea2b298fd9928718d9c0dfc66fe189205 (patch) | |
tree | d900c4af4f3492ef07d4f4ab05a088e9a4bbf6d4 /tests/integration/cli_test.py | |
parent | 94a31642481bf5f6d21e73c783561c05318e619e (diff) |
Write integration tests on new `fig run` linking behaviour
Signed-off-by: Chris Corbyn <chris@w3style.co.uk>
Diffstat (limited to 'tests/integration/cli_test.py')
-rw-r--r-- | tests/integration/cli_test.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/integration/cli_test.py b/tests/integration/cli_test.py index 0380b2b8..dbdd2a8a 100644 --- a/tests/integration/cli_test.py +++ b/tests/integration/cli_test.py @@ -4,14 +4,18 @@ from .testcases import DockerClientTestCase from mock import patch from fig.cli.main import TopLevelCommand from fig.packages.six import StringIO +import sys class CLITestCase(DockerClientTestCase): def setUp(self): super(CLITestCase, self).setUp() + self.old_sys_exit = sys.exit + sys.exit = lambda code=0: None self.command = TopLevelCommand() self.command.base_dir = 'tests/fixtures/simple-figfile' def tearDown(self): + sys.exit = self.old_sys_exit self.command.project.kill() self.command.project.remove_stopped() @@ -70,6 +74,26 @@ class CLITestCase(DockerClientTestCase): self.assertEqual(len(db.containers()), 0) self.assertEqual(len(console.containers()), 0) + @patch('sys.stdout', new_callable=StringIO) + def test_run_with_links(self, mock_stdout): + mock_stdout.fileno = lambda: 1 + + self.command.base_dir = 'tests/fixtures/links-figfile' + self.command.dispatch([str('run'), str('web'), str('/bin/true')], None) + db = self.command.project.get_service('db') + console = self.command.project.get_service('console') + self.assertEqual(len(db.containers()), 1) + self.assertEqual(len(console.containers()), 0) + + @patch('sys.stdout', new_callable=StringIO) + def test_run_with_no_links(self, mock_stdout): + mock_stdout.fileno = lambda: 1 + + self.command.base_dir = 'tests/fixtures/links-figfile' + self.command.dispatch([str('run'), str('--no-links'), str('web'), str('/bin/true')], None) + db = self.command.project.get_service('db') + self.assertEqual(len(db.containers()), 0) + def test_rm(self): service = self.command.project.get_service('simple') service.create_container() |