Example #1
0
        'retcode': 0,
        'stderr': '',
        'stdout': 'v=spf1 ip4:216.73.93.70/31 ip4:216.73.93.72/31 ~all'
    },
}


def _spf_side_effect(key, output_loglevel='info'):
    return _SPF_VALUES.get(key, {'pid': 27310,
                                 'retcode': 0,
                                 'stderr': '',
                                 'stdout': ''})


@skipIf(NO_MOCK, NO_MOCK_REASON)
@skipIf(dig.__virtual__() is False, 'Dig must be installed')
class DigTestCase(TestCase):

    def test_check_ip(self):
        self.assertTrue(dig.check_ip('127.0.0.1'), msg='Not a valid ip address')

    def test_check_ip_ipv6(self):
        self.assertTrue(
            dig.check_ip('1111:2222:3333:4444:5555:6666:7777:8888'),
            msg='Not a valid ip address'
        )

    def test_check_ip_ipv6_valid(self):
        self.assertTrue(dig.check_ip('2607:fa18:0:3::4'))

    def test_check_ip_neg(self):
Example #2
0
        'stdout': 'v=spf1 ip4:216.73.93.70/31 ip4:216.73.93.72/31 ~all'
    },
}


def _spf_side_effect(key, output_loglevel='info'):
    return _SPF_VALUES.get(key, {
        'pid': 27310,
        'retcode': 0,
        'stderr': '',
        'stdout': ''
    })


@skipIf(NO_MOCK, NO_MOCK_REASON)
@skipIf(dig.__virtual__() is False, 'Dig must be installed')
class DigTestCase(TestCase):
    def test_check_ip(self):
        self.assertTrue(dig.check_ip('127.0.0.1'),
                        msg='Not a valid ip address')

    def test_check_ip_ipv6(self):
        self.assertTrue(
            dig.check_ip('1111:2222:3333:4444:5555:6666:7777:8888'),
            msg='Not a valid ip address')

    def test_check_ip_ipv6_valid(self):
        self.assertTrue(dig.check_ip('2607:fa18:0:3::4'))

    def test_check_ip_neg(self):
        self.assertFalse(dig.check_ip('-127.0.0.1'),