Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_returns_failed_validation_on_invalid_mac_address(value):
assert isinstance(uuid(value), ValidationFailure)
def test_returns_failed_validation_on_invalid_email(value):
assert isinstance(fi_business_id(value), ValidationFailure)
def test_returns_failed_validation_on_invalid_range(value, min, max):
assert isinstance(
validators.length(value, min=min, max=max),
validators.ValidationFailure
)
def test_returns_failed_validation_on_invalid_range(value, min, max):
result = validators.between(value, min=min, max=max)
assert isinstance(result, validators.ValidationFailure)
def test_returns_failed_validation_on_invalid_url(address):
assert isinstance(url(address), ValidationFailure)
def test_returns_failed_validation_on_invalid_slug(value):
assert isinstance(slug(value), ValidationFailure)
def test_returns_failed_validation_on_invalid_ipv6_address(address):
assert isinstance(ipv6(address), ValidationFailure)
def test_returns_failed_validation_on_temporal_ssn_when_not_allowed():
assert isinstance(
fi_ssn('010190-900P', allow_temporal_ssn=False),
ValidationFailure
)
def content(data=None):
s = Signer(app.secret_key)
if data:
sep = '\t' if '\t' in data else ','
for line_no, line in enumerate(data.splitlines()):
values = [v.strip() for v in line.split(sep)]
for v in values:
if '@' in v:
try:
validators.email(v)
email = v
break
except validators.ValidationFailure:
pass
else:
if line_no == 0:
continue
flash("Missing email address in the file", "danger")
abort(400)
yield s.get_signature(email).decode() + sep + sep.join(values)
yield '\n'
else:
use_known_orgs = bool(
request.args.get("use-known-orgs") or form.use_known_orgs.data)
org_count = int(
request.args.get("orgs") or request.args.get("org_count")
or request.args.get("org-count") or form.org_count.data or 100)
user_count = int(
request.args.get("users") or request.args.get("user_count")
def isurl(url):
url = format.url(url)
try:
return validators.url(url)
except validators.ValidationFailure:
return False