Exemplo n.º 1
0
    def test_local_move(self, db, action_queue):
        from inbox.server.models.tables.base import Account, FolderItem, Folder
        from inbox.server.actions.base import move

        account = db.session.query(Account).get(ACCOUNT_ID)

        move(db.session, ACCOUNT_ID, 1, account.inbox_folder.name, 'testlabel')

        inbox_items = db.session.query(FolderItem).filter(
            FolderItem.thread_id == 1,
            FolderItem.folder_id == account.inbox_folder_id).count()
        assert inbox_items == 0, "inbox entry still present"

        testlabel_items = db.session.query(FolderItem).join(Folder).filter(
            FolderItem.thread_id == 1, Folder.name == 'testlabel').count()
        assert testlabel_items == 1, "testlabel entry not present"

        assert action_queue.count == 1, "sync-back event not queued"
Exemplo n.º 2
0
    def test_local_move(self, db, action_queue):
        from inbox.server.models.tables.base import Account, FolderItem, Folder
        from inbox.server.actions.base import move

        account = db.session.query(Account).get(ACCOUNT_ID)

        move(db.session, ACCOUNT_ID, 1, account.inbox_folder.name, 'testlabel')

        inbox_items = db.session.query(FolderItem).filter(
            FolderItem.thread_id == 1,
            FolderItem.folder_id == account.inbox_folder_id).count()
        assert inbox_items == 0, "inbox entry still present"

        testlabel_items = db.session.query(FolderItem).join(Folder).filter(
            FolderItem.thread_id == 1,
            Folder.name == 'testlabel').count()
        assert testlabel_items == 1, "testlabel entry not present"

        assert action_queue.count == 1, "sync-back event not queued"
Exemplo n.º 3
0
def test_queue_running(db):
    """ Just the very minimal basics for now: makes sure that the methods run
        without raising an exception. You can use rq-dashboard and a Gmail
        browser window to look in more depth. We'll want to add some
        automatic verification of the behaviour here eventually (see the
        previous tests), but for now I'm leaving it lean and fast.
    """
    from inbox.server.actions.base import (archive, move, copy, delete,
                                           rqworker, register_backends)
    from inbox.server.models.tables.imap import ImapAccount
    from inbox.server.models import session_scope
    register_backends()

    account = db.session.query(ImapAccount).get(ACCOUNT_ID)

    with session_scope() as db_session:
        # "Tips for using Gmail" thread (avoiding all the "Postel lives!" ones)
        archive(db_session, ACCOUNT_ID, 8)
        move(db_session, ACCOUNT_ID, 8, account.all_folder.name,
             account.inbox_folder.name)
    # process actions queue
    rqworker(burst=True)
Exemplo n.º 4
0
def test_queue_running(db):
    """ Just the very minimal basics for now: makes sure that the methods run
        without raising an exception. You can use rq-dashboard and a Gmail
        browser window to look in more depth. We'll want to add some
        automatic verification of the behaviour here eventually (see the
        previous tests), but for now I'm leaving it lean and fast.
    """
    from inbox.server.actions.base import (archive, move, copy, delete,
                                           rqworker, register_backends)
    from inbox.server.models.tables.imap import ImapAccount
    from inbox.server.models import session_scope
    register_backends()

    account = db.session.query(ImapAccount).get(ACCOUNT_ID)

    with session_scope() as db_session:
        # "Tips for using Gmail" thread (avoiding all the "Postel lives!" ones)
        archive(db_session, ACCOUNT_ID, 8)
        move(db_session, ACCOUNT_ID, 8, account.all_folder.name,
             account.inbox_folder.name)
    # process actions queue
    rqworker(burst=True)