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
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
def test_invalid_values(self): for value in {"localhost", "a"}: print("Testing {}".format(value)) self.assertFalse(utils.validate_url(value))
def test_valid_values(self): for value in {"https://foo", "http://localhost/bar"}: print("Testing {}".format(value)) self.assertTrue(utils.validate_url(value))
def test_invalid_values(self): for value in {'localhost', 'a'}: print('Testing {}'.format(value)) self.assertFalse(utils.validate_url(value))
def test_valid_values(self): for value in {'https://foo', 'http://localhost/bar'}: print('Testing {}'.format(value)) self.assertTrue(utils.validate_url(value))