Permalink
Browse files

Merge "Remove extraneous output during testing"

  • Loading branch information...
2 parents f786178 + 114bd74 commit 09c8626bdc3b6eed3e5b72d12c3095d470643a54 Jenkins committed with openstack-gerrit Mar 25, 2013
Showing with 7 additions and 7 deletions.
  1. +0 −1 tests/v1_1/contrib/test_tenant_networks.py
  2. +7 −6 tests/v1_1/test_shell.py
@@ -38,7 +38,6 @@ def test_list_tenant_networks(self):
def test_get_tenant_network(self):
net = cs.tenant_networks.get(1)
cs.assert_called('GET', '/os-tenant-networks/1')
- print(net)
def test_create_tenant_networks(self):
cs.tenant_networks.create(label="net",
@@ -71,8 +71,10 @@ def setUp(self):
lambda *_: fakes.FakeClient))
self.addCleanup(timeutils.clear_time_override)
+ @mock.patch('sys.stdout', StringIO.StringIO())
def run_command(self, cmd):
self.shell.main(cmd.split())
+ return sys.stdout.getvalue()
def assert_called(self, method, url, body=None, **kwargs):
return self.shell.cs.assert_called(method, url, body, **kwargs)
@@ -488,15 +490,14 @@ def test_list_with_flavors(self):
self.run_command('list --flavor 1')
self.assert_called('GET', '/servers/detail?flavor=1')
- @mock.patch('sys.stdout', StringIO.StringIO())
def test_list_fields(self):
- self.run_command('list --fields '
+ output = self.run_command('list --fields '
'host,security_groups,OS-EXT-MOD:some_thing')
self.assert_called('GET', '/servers/detail')
- self.assertIn('computenode1', sys.stdout.getvalue())
- self.assertIn('securitygroup1', sys.stdout.getvalue())
- self.assertIn('OS-EXT-MOD: Some Thing', sys.stdout.getvalue())
- self.assertIn('mod_some_thing_value', sys.stdout.getvalue())
+ self.assertIn('computenode1', output)
+ self.assertIn('securitygroup1', output)
+ self.assertIn('OS-EXT-MOD: Some Thing', output)
+ self.assertIn('mod_some_thing_value', output)
def test_reboot(self):
self.run_command('reboot sample-server')

0 comments on commit 09c8626

Please sign in to comment.