'Test post record initialization failure.'

def test_constructor_post_record_failure(self):

    self.job = job.base_client_job.__new__(job.base_client_job)
    options = dummy()
    options.tag = self.jobtag
    options.cont = False
    options.harness = None
    options.harness_args = None
    options.log = False
    options.verbose = False
    options.hostname = 'localhost'
    options.user = 'my_user'
    options.args = ''
    options.output_dir = ''
    options.tap_report = None
    error = Exception('fail')
    self.god.stub_function(self.job, '_post_record_init')
    self.god.stub_function(self.job, 'record')
    self._setup_pre_record_init(False)
    self.job._post_record_init.expect_call(self.control, options, True, ['more-blah']).and_raises(error)
    self.job.record.expect_call('ABORT', None, None, ('client.job.__init__    failed:    %s' % str(error)))
    self.assertRaises(Exception, self.job.__init__, self.control, options, drop_caches=True, extra_copy_cmdline=['more-blah'])
    self.god.check_playback()
