'L{ESMTPClient} can authenticate using the I{CRAM-MD5} SASL mechanism.
@see: U{http://tools.ietf.org/html/rfc2195}'

def test_crammd5Auth(self):

    realm = DummyRealm()
    p = cred.portal.Portal(realm)
    p.registerChecker(DummyChecker())
    server = DummyESMTP({'CRAM-MD5': cred.credentials.CramMD5Credentials})
    server.portal = p
    client = MyESMTPClient('testpassword')
    cAuth = smtp.CramMD5ClientAuthenticator('testuser')
    client.registerAuthenticator(cAuth)
    d = self.loopback(server, client)
    d.addCallback((lambda x: self.assertEqual(server.authenticated, 1)))
    return d
