Exemplo n.º 1
0
def _validate_http(value, model):
    """Validate that the HTTP value is a URL and that it does not conflict
    with other attributes.

    :param str value: The URL value
    :param consulate.models.agent.Check model: The model instance.
    :rtype: bool

    """
    return utils.validate_url(value) and not model.args and not model.grpc and not model.tcp and not model.ttl
Exemplo n.º 2
0
def _validate_http(value, model):
    """Validate that the HTTP value is a URL and that it does not conflict
    with other attributes.

    :param str value: The URL value
    :param consulate.models.agent.Check model: The model instance.
    :rtype: bool

    """
    return utils.validate_url(value) \
        and not model.args and not model.grpc and not model.tcp \
        and not model.ttl
Exemplo n.º 3
0
 def test_invalid_values(self):
     for value in {"localhost", "a"}:
         print("Testing {}".format(value))
         self.assertFalse(utils.validate_url(value))
Exemplo n.º 4
0
 def test_valid_values(self):
     for value in {"https://foo", "http://localhost/bar"}:
         print("Testing {}".format(value))
         self.assertTrue(utils.validate_url(value))
Exemplo n.º 5
0
 def test_invalid_values(self):
     for value in {'localhost', 'a'}:
         print('Testing {}'.format(value))
         self.assertFalse(utils.validate_url(value))
Exemplo n.º 6
0
 def test_valid_values(self):
     for value in {'https://foo', 'http://localhost/bar'}:
         print('Testing {}'.format(value))
         self.assertTrue(utils.validate_url(value))
Exemplo n.º 7
0
 def test_invalid_values(self):
     for value in {'localhost', 'a'}:
         print('Testing {}'.format(value))
         self.assertFalse(utils.validate_url(value))
Exemplo n.º 8
0
 def test_valid_values(self):
     for value in {'https://foo', 'http://localhost/bar'}:
         print('Testing {}'.format(value))
         self.assertTrue(utils.validate_url(value))