Exemple #1
0
def test_check_billable_units_when_billable_units_matches_page_count(
        client, sample_letter_template, mocker, notification_update):
    mock_logger = mocker.patch("app.celery.tasks.current_app.logger.error")

    create_notification(sample_letter_template,
                        reference="REFERENCE_ABC",
                        billable_units=1)

    check_billable_units(notification_update)

    mock_logger.assert_not_called()
Exemple #2
0
def test_check_billable_units_when_billable_units_does_not_match_page_count(
        client, sample_letter_template, mocker, notification_update):
    mock_logger = mocker.patch("app.celery.tasks.current_app.logger.exception")

    notification = create_notification(sample_letter_template,
                                       reference="REFERENCE_ABC",
                                       billable_units=3)

    check_billable_units(notification_update)

    mock_logger.assert_called_once_with(
        "Notification with id {} has 3 billable_units but DVLA says page count is 1"
        .format(notification.id))
def test_check_billable_units_when_billable_units_does_not_match_page_count(
        client, sample_letter_template, mocker, notification_update):
    mock_logger = mocker.patch('app.celery.tasks.current_app.logger.error')

    notification = create_notification(sample_letter_template,
                                       reference='REFERENCE_ABC',
                                       billable_units=3)

    check_billable_units(notification_update)

    mock_logger.assert_called_once_with(
        'Notification with id {} had 3 billable_units but a page count of 1'.
        format(notification.id))