コード例 #1
0
ファイル: test_net.py プロジェクト: crimv42/saltstack
    def test_ipv6_addr(self):
        '''
        Test IPv6 address validation
        '''
        true_addrs = [
            '::',
            '::1',
            '::1/32',
            '::1/32',
            '::1/128',
            '2a03:4000:c:10aa:1017:f00d:aaaa:a',
        ]

        false_addrs = [
            '1.1.1.1',
            '::1/0',
            '::1/32d',
            '::1/129',
            '2a03:4000:c:10aa:1017:f00d:aaaa:a:4506',
            '2a03::1::2',
        ]

        for addr in true_addrs:
            self.assertTrue(net.ipv6_addr(addr))

        for addr in false_addrs:
            self.assertFalse(net.ipv6_addr(addr))
コード例 #2
0
    def test_ipv6_addr(self):
        """
        Test IPv6 address validation
        """
        true_addrs = [
            "::",
            "::1",
            "::1/32",
            "::1/32",
            "::1/128",
            "2a03:4000:c:10aa:1017:f00d:aaaa:a",
        ]

        false_addrs = [
            "1.1.1.1",
            "::1/0",
            "::1/32d",
            "::1/129",
            "2a03:4000:c:10aa:1017:f00d:aaaa:a:4506",
            "2a03::1::2",
        ]

        for addr in true_addrs:
            self.assertTrue(net.ipv6_addr(addr))

        for addr in false_addrs:
            self.assertFalse(net.ipv6_addr(addr))
コード例 #3
0
    def test_ipv6_addr(self):
        """
        Test IPv6 address validation
        """
        self.assertTrue(net.ipv6_addr("::1"))
        self.assertTrue(net.ipv6_addr("::1/32"))
        self.assertTrue(net.ipv6_addr("::1/32"))
        self.assertTrue(net.ipv6_addr("::1/128"))
        self.assertTrue(net.ipv6_addr("2a03:4000:c:10aa:1017:f00d:aaaa:a"))

        self.assertFalse(net.ipv6_addr("1.1.1.1"))
        self.assertFalse(net.ipv6_addr("::1/0"))
        self.assertFalse(net.ipv6_addr("::1/32d"))
        self.assertFalse(net.ipv6_addr("::1/129"))
コード例 #4
0
    def test_ipv6_addr(self):
        '''
        Test IPv6 address validation
        '''
        self.assertTrue(net.ipv6_addr('::1'))
        self.assertTrue(net.ipv6_addr('::1/32'))
        self.assertTrue(net.ipv6_addr('::1/32'))
        self.assertTrue(net.ipv6_addr('::1/128'))
        self.assertTrue(net.ipv6_addr('2a03:4000:c:10aa:1017:f00d:aaaa:a'))

        self.assertFalse(net.ipv6_addr('1.1.1.1'))
        self.assertFalse(net.ipv6_addr('::1/0'))
        self.assertFalse(net.ipv6_addr('::1/32d'))
        self.assertFalse(net.ipv6_addr('::1/129'))
コード例 #5
0
ファイル: validate_net_test.py プロジェクト: DavideyLee/salt
    def test_ipv6_addr(self):
        '''
        Test IPv6 address validation
        '''
        true_addrs = [
            '::1',
            '::1/32',
            '::1/32',
            '::1/128',
            '2a03:4000:c:10aa:1017:f00d:aaaa:a',
        ]

        false_addrs = [
            '1.1.1.1',
            '::1/0',
            '::1/32d',
            '::1/129',
        ]

        for addr in true_addrs:
            self.assertTrue(net.ipv6_addr(addr))

        for addr in false_addrs:
            self.assertFalse(net.ipv6_addr(addr))