예제 #1
0
def test_settings_mail_mailing_list_edit(client, web2py):
    """
        Can we edit mailing_lists?
    """
    populate_mailing_lists(web2py)

    url = '/settings_mail/mailing_list_edit?mlID=1'
    client.get(url)
    assert client.status == 200

    data = {
        'id': 1,
        'Name': 'Newsletter_edited',
        'Description':
        'The latest offering of whatever we do in this business',
        'Frequency': 'Twice daily, at least',
        'MailChimpListID': '1235346_test'
    }

    client.post(url, data=data)
    assert client.status == 200

    assert data['Name'] in client.text
    ml = web2py.db.mailing_lists(1)
    assert ml.Name == data['Name']
def test_settings_mail_mailing_list_delete(client, web2py):
    """
        Can we delete mailing_lists?
    """
    populate_mailing_lists(web2py)

    url = '/settings_mail/mailing_list_delete?mlID=1'
    client.get(url)
    assert client.status == 200

    query = (web2py.db.mailing_lists.id > 0)
    assert web2py.db(query).count() == 0
def test_settings_mail_mailing_lists(client, web2py):
    """
        Can we list mailing lists?
    """
    populate_mailing_lists(web2py)

    url = '/settings_mail/mailing_lists'
    client.get(url)
    assert client.status == 200

    ml = web2py.db.mailing_lists(1)
    assert ml.Name in client.text