~cypressyew/checkbox/cbt-i18n

« back to all changes in this revision

Viewing changes to plainbox/plainbox/impl/test_result.py

  • Committer: Sylvain Pineau
  • Author(s): Paul Larson
  • Date: 2016-05-16 22:32:21 UTC
  • mfrom: (4350.1.1 further-warning-removal)
  • Revision ID: sylvain_pineau-20160516223221-8ruzrb39dmyp27rv
"automatic merge of lp:~pwlars/checkbox/fix-remaining-self-test-warnings/ by tarmac [r=kissiel][bug=][author=pwlars]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
from plainbox.impl.result import JobResultBuilder
37
37
from plainbox.impl.result import MemoryJobResult
38
38
from plainbox.impl.testing_utils import make_io_log
 
39
from plainbox.vendor import mock
39
40
 
40
41
 
41
42
def load_tests(loader, tests, ignore):
62
63
    def tearDown(self):
63
64
        self.scratch_dir.cleanup()
64
65
 
65
 
    def test_smoke(self):
 
66
    @mock.patch('plainbox.impl.result.logger')
 
67
    def test_smoke(self, mock_logger):
66
68
        result = DiskJobResult({})
67
69
        self.assertEqual(str(result), "None")
68
70
        self.assertEqual(repr(result), "<DiskJobResult>")
69
71
        self.assertIsNone(result.outcome)
70
72
        self.assertIsNone(result.comments)
71
73
        self.assertEqual(result.io_log, ())
 
74
        assert mock_logger.warning.call_count == 1
72
75
        self.assertIsNone(result.return_code)
73
76
        self.assertTrue(result.is_hollow)
74
77
 
75
 
    def test_everything(self):
 
78
    @mock.patch('plainbox.impl.result.logger')
 
79
    def test_everything(self, mock_logger):
76
80
        result = DiskJobResult({
77
81
            'outcome': IJobResult.OUTCOME_PASS,
78
82
            'comments': "it said blah",
91
95
        self.assertEqual(result.outcome, IJobResult.OUTCOME_PASS)
92
96
        self.assertEqual(result.comments, "it said blah")
93
97
        self.assertEqual(result.io_log, ((0, 'stdout', b'blah\n'),))
 
98
        assert mock_logger.warning.call_count == 1
94
99
        self.assertEqual(result.io_log_as_flat_text, 'blah\n')
95
100
        self.assertEqual(result.return_code, 0)
96
101
        self.assertFalse(result.is_hollow)