Beispiel #1
0
def test_add_recipients():
    '''
    Test that a list of recipients can be added in bulk, assigning a default
    empty dict of merge vars when not provided
    '''

    me = NoopMassEmail()

    me.add_recipients([
        {
            'email': '*****@*****.**',
            'name': 'Some test dude',
            'merge_vars': {'SOMETHING': 'test'},
        },
        {
            'email': '*****@*****.**',
            'name': 'Some test dude',
        },
    ])

    recips = me.get_recipients()

    assert len(recips) == 2

    recips = [x for x in me.get_recipients() if x.get('merge_vars') == {}]

    assert len(recips) == 1
Beispiel #2
0
def test_add_recipients():
    '''
    Test that a list of recipients can be added in bulk, assigning a default
    empty dict of merge vars when not provided
    '''

    me = NoopMassEmail()

    me.add_recipients([
        {
            'email': '*****@*****.**',
            'name': 'Some test dude',
            'merge_vars': {
                'SOMETHING': 'test'
            },
        },
        {
            'email': '*****@*****.**',
            'name': 'Some test dude',
        },
    ])

    recips = me.get_recipients()

    assert len(recips) == 2

    recips = [x for x in me.get_recipients() if x.get('merge_vars') == {}]

    assert len(recips) == 1
Beispiel #3
0
def test_can_lazily_add_recipients_and_solidify():
    gen_count = 20

    me = NoopMassEmail()

    me.add_recipients(generate_recipients(gen_count))

    recips = me.get_raw_recipients()

    assert hasattr(recips, '__iter__') and not hasattr(recips, '__len__')

    recips_list = me.solidify_recipients()

    assert len(recips_list) == gen_count
Beispiel #4
0
def test_can_lazily_add_recipients_and_solidify():
    gen_count = 20

    me = NoopMassEmail()

    me.add_recipients(generate_recipients(gen_count))

    recips = me.get_raw_recipients()

    assert hasattr(recips, '__iter__') and not hasattr(recips, '__len__')

    recips_list = me.solidify_recipients()

    assert len(recips_list) == gen_count