'If an MX lookup succeeds but the result set is empty,
L{MXCalculator.getMX} should try to look up an I{A} record for the
requested name and call back its returned Deferred with that
address.'

def test_successWithoutResults(self):

    ip = '1.2.3.4'
    domain = 'example.org'
    class DummyResolver(object, ):
        '\n                                                Fake    resolver    which    will    respond    to    an    MX    lookup    with    an    empty\n                                                result    set.\n\n                                                @ivar    mx:    A    dictionary    mapping    hostnames    to    three-tuples    of\n                                                                results    to    be    returned    from    I{MX}    lookups.\n\n                                                @ivar    a:    A    dictionary    mapping    hostnames    to    addresses    to    be\n                                                                returned    from    I{A}    lookups.\n                                                '
        mx = {domain: ([], [], [])}
        a = {domain: ip}
        def lookupMailExchange(self, domain):
            return defer.succeed(self.mx[domain])
        def getHostByName(self, domain):
            return defer.succeed(self.a[domain])
    self.mx.resolver = DummyResolver()
    d = self.mx.getMX(domain)
    d.addCallback(self.assertEqual, Record_MX(name=ip))
    return d
