def test_cnameWithGlueRecords(self):
        """
        If an MX lookup returns a CNAME and the MX record for the CNAME, the
        L{Deferred} returned by L{MXCalculator.getMX} should be called back
        with the name from the MX record without further lookups being
        attempted.
        """
        lookedUp = []
        alias = "alias.example.com"
        canonical = "canonical.example.com"
        exchange = "mail.example.com"

        class DummyResolver(object):
            def lookupMailExchange(self, domain):
                if domain != alias and lookedUp:
                    # Don't give back any results for anything except the alias
                    # or on any request after the first.
                    return ([], [], [])
                return defer.succeed((
                        [RRHeader(name=alias,
                                  type=Record_CNAME.TYPE,
                                  payload=Record_CNAME(canonical)),
                         RRHeader(name=canonical,
                                  type=Record_MX.TYPE,
                                  payload=Record_MX(name=exchange))],
                        [], []))

        self.mx.resolver = DummyResolver()
        d = self.mx.getMX(alias)
        d.addCallback(self.assertEqual, Record_MX(name=exchange))
        return d
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/mail/test/test_mail.py/MXTestCase.test_cnameWithGlueRecords/operator `or` -> `and`