Remove extraneous output during testing

During shell tests commands were being passed to novaclient and output
was being printed to stdout.  This quickly scrolls useful test output
offscreen, so lets suppress it.

Also removed a print call from a test.

Change-Id: I31c8bf2f92a64d781c9e3350213f2e1503b960ad
This commit is contained in:
Andrew Laski 2013-03-25 13:38:28 -04:00
parent 609cbcef17
commit 114bd74fd2
2 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,6 @@ class TenantNetworkExtensionTests(utils.TestCase):
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",

View File

@ -71,8 +71,10 @@ class ShellTest(utils.TestCase):
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 @@ class ShellTest(utils.TestCase):
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')