Пример #1
0
def test_format_template_stats_to_list():
    counts = {
        'created': 1,
        'pending': 1,
        'delivered': 1,
        'failed': 1,
        'temporary-failure': 1,
        'permanent-failure': 1,
        'technical-failure': 1,
        'do-not-count': 999,
    }
    stats_list = list(
        format_template_stats_to_list({
            'template_2_id': {
                'counts': {},
                'name': 'bar',
            },
            'template_1_id': {
                'counts': counts,
                'name': 'foo',
            },
        }))

    # we don’t care about the order of this function’s output
    assert len(stats_list) == 2
    assert {
        'counts': counts,
        'name': 'foo',
        'requested_count': 7,
        'id': 'template_1_id',
    } in stats_list
    assert {
        'counts': {},
        'name': 'bar',
        'requested_count': 0,
        'id': 'template_2_id',
    } in stats_list
Пример #2
0
def test_format_template_stats_to_list_with_no_stats():
    assert list(format_template_stats_to_list({})) == []