Exemplo n.º 1
0
def pytest_generate_tests(metafunc):
    if 'db' in metafunc.fixturenames:
        dumpfile = absolute_path(config()['BASE_DUMP'])
        savedb = False

        metafunc.parametrize('db', [(dumpfile, savedb)], indirect=True)
Exemplo n.º 2
0
import pytest
import calendar

from sqlalchemy import desc

from tests.util.base import config, api_client
config()

from inbox.models import (Lens, Transaction, Message)

NAMESPACE_ID = 1


def test_lens_tx(api_client, db):
    api_client.post_data('/drafts/', {
        'subject': 'Calaveras Dome / Hammer Dome',
        'to': [{'name': 'Somebody', 'email': '*****@*****.**'}],
        'cc': [{'name': 'Another Person', 'email': '*****@*****.**'}]
    })

    transaction = db.session.query(Transaction). \
        filter(Transaction.table_name == 'message'). \
        order_by(desc(Transaction.id)).first()

    draft = db.session.query(Message).filter(Message.is_draft).\
        order_by(desc(Message.id)).first()
    thread = draft.thread

    filter = Lens(subject='/Calaveras/')
    assert filter.match(transaction)
Exemplo n.º 3
0
def pytest_generate_tests(metafunc):
    if 'db' in metafunc.fixturenames:
        dumpfile = absolute_path(config()['BASE_DUMP'])
        savedb = False

        metafunc.parametrize('db', [(dumpfile, savedb)], indirect=True)
Exemplo n.º 4
0
import pytest

from tests.util.base import config
from tests.util.base import (contact_sync, contacts_provider,
                             ContactsProviderStub)

# Need to set up test config before we can import from
# inbox.models.tables.
config()
from inbox.models import Contact
from inbox.util.misc import MergeError

__all__ = ['contact_sync', 'contacts_provider']

ACCOUNT_ID = 1

# STOPSHIP(emfree): Test multiple distinct remote providers


@pytest.fixture(scope='function')
def alternate_contacts_provider(config, db):
    return ContactsProviderStub('alternate_provider')


def test_merge(config):
    """Test the basic logic of the merge() function."""
    base = Contact(name='Original Name',
                   email_address='*****@*****.**')
    remote = Contact(name='New Name',
                     email_address='*****@*****.**')
    dest = Contact(name='Original Name',