Beispiel #1
0
def test_change_flags(db, default_account, message, folder, mock_imapclient):
    mock_imapclient.add_folder_data(folder.name, {})
    mock_imapclient.add_flags = mock.Mock()
    mock_imapclient.remove_flags = mock.Mock()
    add_fake_imapuid(db.session, default_account.id, message, folder, 22)
    with writable_connection_pool(default_account.id).get() as crispin_client:
        mark_unread(crispin_client, default_account.id, message.id,
                    {"unread": False})
        mock_imapclient.add_flags.assert_called_with([22], ["\\Seen"],
                                                     silent=True)

        mark_unread(crispin_client, default_account.id, message.id,
                    {"unread": True})
        mock_imapclient.remove_flags.assert_called_with([22], ["\\Seen"],
                                                        silent=True)

        mark_starred(crispin_client, default_account.id, message.id,
                     {"starred": True})
        mock_imapclient.add_flags.assert_called_with([22], ["\\Flagged"],
                                                     silent=True)

        mark_starred(crispin_client, default_account.id, message.id,
                     {"starred": False})
        mock_imapclient.remove_flags.assert_called_with([22], ["\\Flagged"],
                                                        silent=True)
Beispiel #2
0
def test_change_flags(db, default_account, message, folder, mock_imapclient):
    mock_imapclient.add_folder_data(folder.name, {})
    mock_imapclient.add_flags = mock.Mock()
    mock_imapclient.remove_flags = mock.Mock()
    add_fake_imapuid(db.session, default_account.id, message, folder, 22)
    mark_unread(default_account.id, message.id, {'unread': False})
    mock_imapclient.add_flags.assert_called_with([22], ['\\Seen'])

    mark_unread(default_account.id, message.id, {'unread': True})
    mock_imapclient.remove_flags.assert_called_with([22], ['\\Seen'])

    mark_starred(default_account.id, message.id, {'starred': True})
    mock_imapclient.add_flags.assert_called_with([22], ['\\Flagged'])

    mark_starred(default_account.id, message.id, {'starred': False})
    mock_imapclient.remove_flags.assert_called_with([22], ['\\Flagged'])
def test_change_flags(db, default_account, message, folder, mock_imapclient):
    mock_imapclient.add_folder_data(folder.name, {})
    mock_imapclient.add_flags = mock.Mock()
    mock_imapclient.remove_flags = mock.Mock()
    add_fake_imapuid(db.session, default_account.id, message, folder, 22)
    mark_unread(default_account.id, message.id, {'unread': False})
    mock_imapclient.add_flags.assert_called_with([22], ['\\Seen'])

    mark_unread(default_account.id, message.id, {'unread': True})
    mock_imapclient.remove_flags.assert_called_with([22], ['\\Seen'])

    mark_starred(default_account.id, message.id, {'starred': True})
    mock_imapclient.add_flags.assert_called_with([22], ['\\Flagged'])

    mark_starred(default_account.id, message.id, {'starred': False})
    mock_imapclient.remove_flags.assert_called_with([22], ['\\Flagged'])
Beispiel #4
0
def test_change_flags(db, default_account, message, folder, mock_imapclient):
    mock_imapclient.add_folder_data(folder.name, {})
    mock_imapclient.add_flags = mock.Mock()
    mock_imapclient.remove_flags = mock.Mock()
    add_fake_imapuid(db.session, default_account.id, message, folder, 22)
    with writable_connection_pool(default_account.id).get() as crispin_client:
        mark_unread(crispin_client, default_account.id, message.id,
                    {'unread': False})
        mock_imapclient.add_flags.assert_called_with([22], ['\\Seen'], silent=True)

        mark_unread(crispin_client, default_account.id, message.id,
                    {'unread': True})
        mock_imapclient.remove_flags.assert_called_with([22], ['\\Seen'], silent=True)

        mark_starred(crispin_client, default_account.id, message.id,
                     {'starred': True})
        mock_imapclient.add_flags.assert_called_with([22], ['\\Flagged'], silent=True)

        mark_starred(crispin_client, default_account.id, message.id,
                     {'starred': False})
        mock_imapclient.remove_flags.assert_called_with([22], ['\\Flagged'], silent=True)