'Assert that a login attempt has been made, that the credentials and
interfaces passed to it are correct, and that when the login request
is satisfied, a successful response is sent by the ESMTP server
instance.
@param loginArgs: A C{list} previously passed to L{portalFactory}.
@param username: The login user.
@param password: The login password.'

def assertServerAuthenticated(self, loginArgs, username='username', password='password'):

    (d, credentials, mind, interfaces) = loginArgs.pop()
    self.assertEqual(loginArgs, [])
    self.assertTrue(twisted.cred.credentials.IUsernamePassword.providedBy(credentials))
    self.assertEqual(credentials.username, username)
    self.assertTrue(credentials.checkPassword(password))
    self.assertIn(smtp.IMessageDeliveryFactory, interfaces)
    self.assertIn(smtp.IMessageDelivery, interfaces)
    d.callback((smtp.IMessageDeliveryFactory, None, (lambda : None)))
    self.assertEqual(['235    Authentication    successful.'], self.transport.value().splitlines())
