Esempio n. 1
0
def test_process_email_different_messageid(_mock):
    # Test 'Message-ID' works too.
    message = {'CustomHeaders': [
        {'Name': 'Message-ID', 'Value': '<gmail_tastic>'}]}
    process_email(message)
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
Esempio n. 2
0
def test_process_email_different_messageid_case(_mock):
    # Test 'Message-Id' (different case)
    message = {'CustomHeaders': [{'Name': 'Message-Id', 'Value': '<its_ios>'}]}
    process_email(message)
    assert ActivityLogEmails.objects.filter(messageid='<its_ios>').exists()
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.count() == 1
Esempio n. 3
0
def test_process_email_different_messageid_case(_mock):
    # Test 'Message-Id' (different case)
    message = {'CustomHeaders': [
        {'Name': 'Message-Id', 'Value': '<its_ios>'}]}
    process_email(message)
    assert ActivityLogEmails.objects.filter(
        messageid='<its_ios>').exists()
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.count() == 1
Esempio n. 4
0
def test_process_email_different_messageid(_mock):
    # Test 'Message-ID' works too.
    message = {'CustomHeaders': [
        {'Name': 'Message-ID', 'Value': '<gmail_tastic>'}]}
    process_email(message)
    assert ActivityLogEmails.objects.filter(
        messageid='<gmail_tastic>').exists()
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.count() == 1
Esempio n. 5
0
def test_process_email_different_messageid(_mock):
    # Test 'Message-ID' works too.
    message = {
        'CustomHeaders': [{
            'Name': 'Message-ID',
            'Value': '<gmail_tastic>'
        }]
    }
    process_email(message)
    assert ActivityLogEmails.objects.filter(
        messageid='<gmail_tastic>').exists()
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.count() == 1
Esempio n. 6
0
def test_process_email(_mock):
    # MessageId not in the message we pass to process_email should fail too.
    process_email({})
    assert _mock.call_count == 0
    message = sample_message_content.get('Message')
    process_email(message)
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
Esempio n. 7
0
def test_process_email(_mock):
    # MessageId not in the message we pass to process_email should fail too.
    process_email({})
    assert _mock.call_count == 0
    message = {"MessageId": "Dave"}
    process_email(message)
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
Esempio n. 8
0
def test_process_email(_mock):
    # MessageId not in the message we pass to process_email should fail too.
    process_email({})
    assert _mock.call_count == 0
    message = {'MessageId': 'Dave'}
    process_email(message)
    assert _mock.call_count == 1
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
Esempio n. 9
0
def test_process_email(_mock):
    # MessageId not in the message we pass to process_email should fail too.
    process_email({})
    assert _mock.call_count == 0
    message = sample_message_content.get('Message')
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.filter(
        messageid='This is a MessageID').exists()
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.count() == 1
Esempio n. 10
0
def test_process_email(_mock):
    # MessageId not in the message we pass to process_email should fail too.
    process_email({})
    assert _mock.call_count == 0
    message = sample_message_content.get('Message')
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.filter(
        messageid='This is a MessageID').exists()
    # don't try to process the same message twice
    process_email(message)
    assert _mock.call_count == 1
    assert ActivityLogEmails.objects.count() == 1