# Path: stackalytics/processor/driverlog.py
# LOG = logging.getLogger(__name__)
# def _find_ci_result(review, drivers):
# def log(review_iterator, drivers):


import copy
import testtools
from stackalytics.processor import driverlog
    def setUp(self):
        super(TestDriverlog, self).setUp()

    def test_find_ci_result_success(self):
        drivers = [DRIVER]
        review = copy.deepcopy(REVIEW)
        review['comments'].append(COMMENT_SUCCESS)

        res = list(driverlog.log([review], drivers))

        expected_result = {
            'user_id': 'ci:virt_nova_driver',
            'value': True,
            'message': 'build successful',
            'date': 1234567890,
            'branch': 'master',
            'review_id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e',
            'review_number': '97860',
            'driver_name': 'Virt Nova Driver',
            'driver_vendor': 'Virt Inc',
            'module': 'nova',
        }
        self.assertEqual(1, len(res), 'One CI result is expected')
        self.assertEqual(expected_result, res[0])

    def test_find_ci_result_failure(self):
        drivers = [DRIVER]
        review = copy.deepcopy(REVIEW)
        review['comments'].append(COMMENT_FAILURE)


# Path: stackalytics/processor/driverlog.py
# LOG = logging.getLogger(__name__)
# def _find_ci_result(review, drivers):
# def log(review_iterator, drivers):


# Path: stackalytics/tests/unit/test_driverlog.py
import copy
import testtools
from stackalytics.processor import driverlog

    def setUp(self):
        super(TestDriverlog, self).setUp()

    def test_find_ci_result_success(self):
        drivers = [DRIVER]
        review = copy.deepcopy(REVIEW)
        review['comments'].append(COMMENT_SUCCESS)

        res = list(driverlog.log([review], drivers))

        expected_result = {
            'user_id': 'ci:virt_nova_driver',
            'value': True,
            'message': 'build successful',
            'date': 1234567890,
            'branch': 'master',
            'review_id': 'I1045730e47e9e6ad31fcdfbaefdad77e2f3b2c3e',
            'review_number': '97860',
            'driver_name': 'Virt Nova Driver',
            'driver_vendor': 'Virt Inc',
            'module': 'nova',
        }
        self.assertEqual(1, len(res), 'One CI result is expected')
        self.assertEqual(expected_result, res[0])

    def test_find_ci_result_failure(self):
        drivers = [DRIVER]
        review = copy.deepcopy(REVIEW)
        review['comments'].append(COMMENT_FAILURE)


        res = list(driverlog.log([review], drivers))