~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/tests/test_client.py

  • Committer: Curtis Hovey
  • Date: 2012-01-31 04:59:54 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: curtis.hovey@canonical.com-20120131045954-ei5480cfcfjhxgrn
make_mime_message calls to make_message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    return message
46
46
 
47
47
 
48
 
def make_mime_message(message_id, text, headers=None, hidden=False,
 
48
def make_mime_message(message_id, body='body', headers=None, hidden=False,
49
49
                      attachment_type=None):
50
50
    message = MIMEMultipart()
51
 
    message.attach(MIMEText(text))
52
 
    message['Message-Id'] = message_id
53
 
    if headers is not None:
54
 
        for k, v in headers.items():
55
 
            message[k] = v
 
51
    message.attach(MIMEText(body))
56
52
    if attachment_type is not None:
57
53
        attachment = Message()
58
54
        attachment.set_payload('attactment data.')
59
55
        attachment['Content-Type'] = attachment_type
60
 
        attachment['Content-Disposition'] = (
61
 
            'attachment; filename="file.ext"')
 
56
        attachment['Content-Disposition'] = 'attachment; filename="file.ext"'
62
57
        message.attach(attachment)
63
 
    dict_message = {
64
 
        'message_id': message_id,
65
 
        'headers': dict(message.items()),
66
 
        'body': message.get_payload(),
67
 
        }
68
 
    return dict_message
 
58
    return make_message(message_id, message.get_payload(), headers, hidden)
69
59
 
70
60
 
71
61
def threaded_messages(messages):