Skip to content
Snippets Groups Projects
Commit bce6df99 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Fixed type of min and max length for tags

parent bfd3cec4
Branches
Tags
No related merge requests found
......@@ -117,8 +117,8 @@ def test_tag_name_validator_valid():
def test_tag_length_validator_invalid():
min = toolkit.config.get('ckanext.odsh.min_tag_length',2)
max = toolkit.config.get('ckanext.odsh.max_tag_length',100)
min = int(toolkit.config.get('ckanext.odsh.min_tag_length',2))
max = int(toolkit.config.get('ckanext.odsh.max_tag_length',100))
length = round((min + max) / 2)
test_string = _create_test_string(length)
with pytest.raises(Exception):
......@@ -126,7 +126,7 @@ def test_tag_length_validator_invalid():
def test_tag_length_validator_valid():
max = toolkit.config.get('ckanext.odsh.max_tag_length',100)
max = int(toolkit.config.get('ckanext.odsh.max_tag_length',100))
length = max + 1
test_string = _create_test_string(length)
tag_length_validator(test_string, None)
......
......@@ -313,8 +313,8 @@ def validate_formats(data, errors):
def tag_length_validator(value, context):
"""Ensures that tag length is in the acceptable range.
"""
min_tag_length = tk.config.get('ckanext.odsh.min_tag_length',2)
max_tag_length = tk.config.get('ckanext.odsh.max_tag_length',100)
min_tag_length = int(tk.config.get('ckanext.odsh.min_tag_length',2))
max_tag_length = int(tk.config.get('ckanext.odsh.max_tag_length',100))
if len(value) < min_tag_length:
raise toolkit.Invalid(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment