def test_succeeded(self, mock_docker_run, mock_docker_stop, mock_docker_start): success = Result('tox') success.succeeded = True failure = Result('flake8') failure.succeeded = False self.job.results['tox'] = success self.assertTrue(self.job.succeeded) self.job.results['flake8'] = failure self.assertFalse(self.job.succeeded)
def test_update_result_failure(self): result = ProcessResult('tox') result.out = 'Oh snap' result.return_code = 1 failure = Result('tox') failure.update_result(result) self.assertFalse(failure.succeeded) self.assertEquals(failure.log, 'Oh snap') self.assertEquals(failure.task, 'tox')
def test_update_result_success(self): result = ProcessResult('tox') result.out = 'Success' result.return_code = 0 success = Result('tox') success.update_result(result) self.assertTrue(success.succeeded) self.assertEquals(success.log, 'Success') self.assertEquals(success.task, 'tox')
def test_serialize(self): error = Result('tox') error.update_error('Command not found') self.assertEqual(Result.serialize(error), error.__dict__) self.assertEqual(Result.serialize(Result.serialize(error)), error.__dict__)
def test_update_error(self): error = Result('tox') error.update_error('Command not found') self.assertFalse(error.succeeded) self.assertEquals(error.log, 'Command not found') self.assertEquals(error.task, 'tox')