def _test_upgrade_check(self, code, code_name, m_stdout):
        method_success_m = mock.Mock()
        method_success_m.return_value = status.UpgradeCheckResult(0, 'foo')
        method_code_m = mock.Mock()
        method_code_m.return_value = status.UpgradeCheckResult(code, 'bar')

        self.cmd.check_methods = {'baz': method_success_m,
                                  'blah': method_code_m}
        self.assertEqual(code, self.cmd.upgrade_check())

        output = m_stdout.getvalue()
        self.assertIn('baz', output)
        self.assertIn('bar', output)
        self.assertIn('foo', output)
        self.assertIn('blah', output)
        self.assertIn('Success', output)
        self.assertIn(code_name, output)
    def test_upgrade_result_get_details(self):
        res = status.UpgradeCheckResult(0, 'a ' * 50)

        self.assertEqual(
            (('a ' * 30).rstrip() + '\n' + (' ' * 9) + ('a ' * 20)).rstrip(),
            res.get_details())