This commit is contained in:
Hocuri
2020-05-23 14:32:38 +02:00
parent 89341c1ceb
commit d5e6b6231d
2 changed files with 10 additions and 16 deletions

View File

@@ -1,13 +1,4 @@
import os
import threading
import click
import ssl
import atexit
import email
import contextlib
import time
import imaplib import imaplib
from subprocess import call
INBOX = "Inbox" INBOX = "Inbox"
SENT = "Sent" SENT = "Sent"
@@ -25,6 +16,7 @@ def db_folder_attr(name):
s.db_folder[name] = val s.db_folder[name] = val
return property(fget, fset, None, None) return property(fget, fset, None, None)
class ImapConn(): class ImapConn():
def __init__(self, foldername, conn_info): def __init__(self, foldername, conn_info):
self.foldername = foldername self.foldername = foldername
@@ -44,13 +36,12 @@ class ImapConn():
result, data = self.connection.search(None, 'UnSeen') result, data = self.connection.search(None, 'UnSeen')
try: try:
mails_uid = data[0].split() mails_uid = data[0].split()
newest_mail = mails_uid[0]
print("New mails") print("New mails")
# self.connection.store(data[0].replace(' ',','),'+FLAGS','\Seen') # self.connection.store(data[0].replace(' ',','),'+FLAGS','\Seen')
for e_id in mails_uid: for e_id in mails_uid:
self.connection.store(e_id, '+FLAGS', '\Seen') self.connection.store(e_id, '+FLAGS', '\\Seen')
print("marked:",e_id) print("marked:", e_id)
return True return True
except IndexError: except IndexError:

View File

@@ -7,6 +7,9 @@ from deltachat import const, Account
from deltachat.message import Message from deltachat.message import Message
from deltachat.hookspec import account_hookimpl from deltachat.hookspec import account_hookimpl
from datetime import datetime, timedelta from datetime import datetime, timedelta
from conftest import (wait_configuration_progress,
wait_securejoin_inviter_progress)
from deltachat import direct_imap
@pytest.mark.parametrize("msgtext,res", [ @pytest.mark.parametrize("msgtext,res", [
@@ -657,10 +660,10 @@ class TestOnlineAccount:
assert list(ac2.get_fresh_messages()) assert list(ac2.get_fresh_messages())
for i in range(0,30): for i in range(0, 30):
if imap2.get_unread_cnt() == 1: if imap2.get_unread_cnt() == 1:
break break
sleep(1) # We might need to wait because Imaplib is slower than DC-Core time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
assert imap2.get_unread_cnt() == 1 assert imap2.get_unread_cnt() == 1
incoming_on_ac2.mark_seen() incoming_on_ac2.mark_seen()
@@ -670,10 +673,10 @@ class TestOnlineAccount:
assert not list(ac2.get_fresh_messages()) assert not list(ac2.get_fresh_messages())
# The new messages should be seen now. # The new messages should be seen now.
for i in range(0,30): for i in range(0, 30):
if imap2.get_unread_cnt() == 0: if imap2.get_unread_cnt() == 0:
break break
sleep(1) # We might need to wait because Imaplib is slower than DC-Core time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
assert imap2.get_unread_cnt() == 0 assert imap2.get_unread_cnt() == 0
def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp): def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp):