def _honorsESMTPArguments(self, username, password):
        """
        L{twisted.mail.smtp.sendmail} creates the ESMTP factory with the ESMTP
        arguments.
        """
        reactor = MemoryReactor()
        smtp.sendmail("localhost", "source@address", "recipient@address",
                      b"message", reactor=reactor, username=username,
                      password=password, requireTransportSecurity=True,
                      requireAuthentication=True)
        factory = reactor.tcpClients[0][2]
        self.assertEqual(factory._requireTransportSecurity, True)
        self.assertEqual(factory._requireAuthentication, True)
        self.assertEqual(factory.username, b"foo")
        self.assertEqual(factory.password, b"bar")

        L{twisted.mail.smtp.sendmail} creates the ESMTP factory with the ESMTP
        arguments.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_smtp.py