Пример #1
0
    def test_validate_ip_pools(self):
        pools = [[{'end': '10.0.0.254'}],
                 [{'start': '10.0.0.254'}],
                 [{'start': '1000.0.0.254',
                   'end': '1.1.1.1'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254',
                   'forza': 'juve'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254'},
                  {'end': '10.0.0.254'}],
                 [None],
                 None]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [[{'end': '10.0.0.254', 'start': '10.0.0.2'},
                  {'start': '11.0.0.2', 'end': '11.1.1.1'}],
                 [{'start': '11.0.0.2', 'end': '11.0.0.100'}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)

        invalid_ip = '10.0.0.2\r'
        pools = [[{'end': '10.0.0.254', 'start': invalid_ip}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertEqual("'%s' is not a valid IP address" % invalid_ip,
                             msg)
Пример #2
0
    def test_validate_ip_pools(self):
        pools = [[{'end': '10.0.0.254'}],
                 [{'start': '10.0.0.254'}],
                 [{'start': '1000.0.0.254',
                   'end': '1.1.1.1'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254',
                   'forza': 'juve'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254'},
                  {'end': '10.0.0.254'}],
                 [None],
                 None]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [[{'end': '10.0.0.254', 'start': '10.0.0.2'},
                  {'start': '11.0.0.2', 'end': '11.1.1.1'}],
                 [{'start': '11.0.0.2', 'end': '11.0.0.100'}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)

        invalid_ip = '10.0.0.2\r'
        pools = [[{'end': '10.0.0.254', 'start': invalid_ip}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertEqual("'%s' is not a valid IP address" % invalid_ip,
                             msg)
Пример #3
0
    def test_validate_ip_pools(self):
        pools = [[{
            'end': '10.0.0.254'
        }], [{
            'start': '10.0.0.254'
        }], [{
            'start': '1000.0.0.254',
            'end': '1.1.1.1'
        }], [{
            'start': '10.0.0.2',
            'end': '10.0.0.254',
            'forza': 'juve'
        }], [{
            'start': '10.0.0.2',
            'end': '10.0.0.254'
        }, {
            'end': '10.0.0.254'
        }], [None], None]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [[{
            'end': '10.0.0.254',
            'start': '10.0.0.2'
        }, {
            'start': '11.0.0.2',
            'end': '11.1.1.1'
        }], [{
            'start': '11.0.0.2',
            'end': '11.0.0.100'
        }]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)
Пример #4
0
    def test_validate_ip_pools(self):
        pools = [
            [{"end": "10.0.0.254"}],
            [{"start": "10.0.0.254"}],
            [{"start": "1000.0.0.254", "end": "1.1.1.1"}],
            [{"start": "10.0.0.2", "end": "10.0.0.254", "forza": "juve"}],
            [{"start": "10.0.0.2", "end": "10.0.0.254"}, {"end": "10.0.0.254"}],
            [None],
            None,
        ]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [
            [{"end": "10.0.0.254", "start": "10.0.0.2"}, {"start": "11.0.0.2", "end": "11.1.1.1"}],
            [{"start": "11.0.0.2", "end": "11.0.0.100"}],
        ]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)

        invalid_ip = "10.0.0.2\r"
        pools = [[{"end": "10.0.0.254", "start": invalid_ip}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertEqual("'%s' is not a valid IP address" % invalid_ip, msg)
Пример #5
0
    def test_validate_ip_pools(self):
        pools = [[{'end': '10.0.0.254'}],
                 [{'start': '10.0.0.254'}],
                 [{'start': '1000.0.0.254',
                   'end': '1.1.1.1'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254',
                   'forza': 'juve'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254'},
                  {'end': '10.0.0.254'}],
                 [None],
                 None]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [[{'end': '10.0.0.254', 'start': '10.0.0.2'},
                  {'start': '11.0.0.2', 'end': '11.1.1.1'}],
                 [{'start': '11.0.0.2', 'end': '11.0.0.100'}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)
Пример #6
0
    def test_validate_ip_pools(self):
        pools = [
            [{"end": "10.0.0.254"}],
            [{"start": "10.0.0.254"}],
            [{"start": "1000.0.0.254", "end": "1.1.1.1"}],
            [{"start": "10.0.0.2", "end": "10.0.0.254", "forza": "juve"}],
            [{"start": "10.0.0.2", "end": "10.0.0.254"}, {"end": "10.0.0.254"}],
            [None],
            None,
        ]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [
            [{"end": "10.0.0.254", "start": "10.0.0.2"}, {"start": "11.0.0.2", "end": "11.1.1.1"}],
            [{"start": "11.0.0.2", "end": "11.0.0.100"}],
        ]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)