def test_get_emails_fail(gmail_username, gmail_password): connection = imap.connect() imap.authenticate(connection, gmail_username, gmail_password) with pytest.raises(exception.IMAPException): emails = imap.get_emails(connection, 'UNKNOWN FILTER') assert emails
def test_authenticate_fail(): connection = imap.connect() with pytest.raises(exception.IMAPException): auth = imap.authenticate(connection, 'fake username', 'fake_password') assert auth
def test_authenticate(gmail_username, gmail_password): connection = imap.connect() auth = imap.authenticate(connection, gmail_username, gmail_password) assert auth
def test_connect_fail(): with pytest.raises(exception.IMAPException): connection = imap.connect(host='unknown host', port=1000) assert connection
def test_connect(): connection = imap.connect() assert isinstance(connection, imaplib.IMAP4_SSL)