def _validate_interval(value, model): """Validate that interval does not conflict with other attributes. :param str value: The interval value :param consulate.models.agent.Check model: The model instance. :rtype: bool """ return utils.validate_go_interval(value) and not model.ttl
def _validate_ttl(value, model): """Validate that the TTL does not conflict with other attributes. :param str value: The TTL value :param consulate.models.agent.Check model: The model instance. :rtype: bool """ is_valid = utils.validate_go_interval(value) return is_valid and not model.args and not model.grpc and not model.http and not model.tcp and not model.interval
def _validate_ttl(value, model): """Validate that the TTL does not conflict with other attributes. :param str value: The TTL value :param consulate.models.agent.Check model: The model instance. :rtype: bool """ return utils.validate_go_interval(value) and not model.args \ and not model.grpc and not model.http \ and not model.tcp and not model.interval
def test_invalid_values(self): for value in {"100", "1 year", "5M", "30S"}: print("Testing {}".format(value)) self.assertFalse(utils.validate_go_interval(value))
def test_valid_values(self): for value in {"5µs", "300ms", "-1.5h", "2h45m", "5m", "30s"}: print("Testing {}".format(value)) self.assertTrue(utils.validate_go_interval(value))
def test_invalid_values(self): for value in {'100', '1 year', '5M', '30S'}: print('Testing {}'.format(value)) self.assertFalse(utils.validate_go_interval(value))
def test_valid_values(self): for value in {'5µs', '300ms', '-1.5h', '2h45m', '5m', '30s'}: print('Testing {}'.format(value)) self.assertTrue(utils.validate_go_interval(value))