diff --git a/tests/v1_1/contrib/test_tenant_networks.py b/tests/v1_1/contrib/test_tenant_networks.py index b66cc5b96..a96a83149 100644 --- a/tests/v1_1/contrib/test_tenant_networks.py +++ b/tests/v1_1/contrib/test_tenant_networks.py @@ -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", diff --git a/tests/v1_1/test_shell.py b/tests/v1_1/test_shell.py index 13b018a0e..4d67523f2 100644 --- a/tests/v1_1/test_shell.py +++ b/tests/v1_1/test_shell.py @@ -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')