コード例 #1
0
ファイル: test_folders.py プロジェクト: nylas/sync-engine
def test_folder_stripping(db, generic_account, imap_api_client):
    # Check that regular IMAP paths get converted to unix-style paths
    generic_account.folder_separator = '.'
    folder = add_fake_folder(db.session, generic_account)
    add_fake_category(db.session, generic_account.namespace.id,
                      'INBOX.Red.Carpet')

    r = imap_api_client.get_data('/folders')
    for folder in r:
        if 'Carpet' in folder['display_name']:
            assert folder['display_name'] == 'INBOX/Red/Carpet'

    # Check that if we define an account-level prefix, it gets stripped
    # from the API response.
    generic_account.folder_prefix = 'INBOX.'
    db.session.commit()

    r = imap_api_client.get_data('/folders')
    for folder in r:
        if 'Carpet' in folder['display_name']:
            assert folder['display_name'] == 'Red/Carpet'

    # Test again with a prefix without integrated separator:
    generic_account.folder_prefix = 'INBOX'
    db.session.commit()

    r = imap_api_client.get_data('/folders')
    for folder in r:
        if 'Carpet' in folder['display_name']:
            assert folder['display_name'] == 'Red/Carpet'
コード例 #2
0
ファイル: test_searching.py プロジェクト: nylas/sync-engine
def test_imap_thread_search_unicode(db, imap_api_client, generic_account,
                                    imap_folder, imap_connection,
                                    sorted_imap_messages,
                                    sorted_imap_threads, is_streaming):
    search_client = get_search_client(generic_account)
    assert isinstance(search_client, IMAPSearchClient)

    if is_streaming:
        threads = imap_api_client.get_data('/threads/search/streaming?q=存档')
    else:
        threads = imap_api_client.get_data('/threads/search?q=存档')

    imap_connection.assert_search([u"TEXT", u"\u5b58\u6863"], "UTF-8")
    assert_search_result(sorted_imap_threads, threads)
コード例 #3
0
ファイル: test_searching.py プロジェクト: nylas/sync-engine
def test_imap_thread_search(imap_api_client, generic_account,
                            imap_folder, imap_connection,
                            sorted_imap_messages,
                            sorted_imap_threads, is_streaming):
    search_client = get_search_client(generic_account)
    assert isinstance(search_client, IMAPSearchClient)

    if is_streaming:
        threads = imap_api_client.get_data('/threads/search/streaming?q=blah%20blah%20blah')
    else:
        threads = imap_api_client.get_data('/threads/search?q=blah%20blah%20blah')

    imap_connection.assert_search(["TEXT", "blah blah blah"])
    assert_search_result(sorted_imap_threads, threads)