예제 #1
0
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
예제 #2
0
def test_authenticate_fail():
    connection = imap.connect()
    with pytest.raises(exception.IMAPException):
        auth = imap.authenticate(connection, 'fake username', 'fake_password')
        assert auth
예제 #3
0
def test_authenticate(gmail_username, gmail_password):
    connection = imap.connect()
    auth = imap.authenticate(connection, gmail_username, gmail_password)
    assert auth
예제 #4
0
def test_connect_fail():
    with pytest.raises(exception.IMAPException):
        connection = imap.connect(host='unknown host', port=1000)
        assert connection
예제 #5
0
def test_connect():
    connection = imap.connect()
    assert isinstance(connection, imaplib.IMAP4_SSL)