Пример #1
0
def test_sanitize_subject(default_account):
    from inbox.log import configure_logging
    configure_logging()
    # Raw message with encoded null bytes in subject header.
    raw_message_with_wonky_subject = \
'''From: "UPS My Choice" <*****@*****.**>
To: [email protected]
Subject: =?UTF-8?B?WW91ciBVUFMgUGFja2FnZSB3YXMgZGVsaXZlcmVkAAAA?=
Content-Type: text/html; charset=UTF-8
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347

--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347
'''
    m = Message.create_from_synced(default_account, 22, '[Gmail]/All Mail',
                                   datetime.datetime.utcnow(),
                                   raw_message_with_wonky_subject)
    assert m.subject == u'Your UPS Package was delivered'
def test_sanitize_subject(default_account):
    from inbox.log import configure_logging
    configure_logging()
    # Raw message with encoded null bytes in subject header.
    raw_message_with_wonky_subject = \
'''From: "UPS My Choice" <*****@*****.**>
To: [email protected]
Subject: =?UTF-8?B?WW91ciBVUFMgUGFja2FnZSB3YXMgZGVsaXZlcmVkAAAA?=
Content-Type: text/html; charset=UTF-8
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347

--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

--==_mimepart_553921a23aa2c_3aee3fe2e442b2b815347
'''
    m = Message.create_from_synced(default_account, 22, '[Gmail]/All Mail',
                                   datetime.datetime.utcnow(),
                                   raw_message_with_wonky_subject)
    assert m.subject == u'Your UPS Package was delivered'
Пример #3
0
import json
import time
from datetime import datetime, timedelta

from inbox.heartbeat.store import (HeartbeatStore, HeartbeatStatusProxy,
                                   HeartbeatStatusKey)
from inbox.heartbeat.status import (clear_heartbeat_status, list_all_accounts,
                                    list_alive_accounts, list_dead_accounts,
                                    heartbeat_summary, get_account_metadata,
                                    get_heartbeat_status, get_ping_status,
                                    AccountHeartbeatStatus)
from inbox.heartbeat.config import ALIVE_EXPIRY

from inbox.log import configure_logging

configure_logging()

from mockredis import MockRedis
# Note that all Redis commands are mocked via mockredis in conftest.py.


def proxy_for(account_id,
              folder_id,
              email='*****@*****.**',
              provider='gmail',
              device_id=0):
    return HeartbeatStatusProxy(account_id=account_id,
                                folder_id=folder_id,
                                folder_name="Inbox",
                                email_address=email,
                                provider_name=provider,
import pytest
import json
import time
from datetime import datetime, timedelta

from inbox.heartbeat.store import (HeartbeatStore, HeartbeatStatusProxy,
                                   HeartbeatStatusKey)
from inbox.heartbeat.status import (clear_heartbeat_status, list_all_accounts,
                                    list_alive_accounts, list_dead_accounts,
                                    heartbeat_summary, get_account_metadata,
                                    get_heartbeat_status, get_ping_status,
                                    AccountHeartbeatStatus)
from inbox.heartbeat.config import ALIVE_EXPIRY

from inbox.log import configure_logging
configure_logging()

from mockredis import MockRedis
# Note that all Redis commands are mocked via mockredis in conftest.py.


def proxy_for(account_id, folder_id, email='*****@*****.**', provider='gmail',
              device_id=0):
    return HeartbeatStatusProxy(account_id=account_id, folder_id=folder_id,
                                folder_name="Inbox",
                                email_address=email,
                                provider_name=provider,
                                device_id=device_id)


def fuzzy_equals(a, b):