diff --git a/zaqar/common/api/schemas/pools.py b/zaqar/common/api/schemas/pools.py index 2a7765a59..ec9eee4d4 100644 --- a/zaqar/common/api/schemas/pools.py +++ b/zaqar/common/api/schemas/pools.py @@ -26,13 +26,13 @@ patch_options = { } } -# NOTE(cpp-cabrera): a string valid for use in a URI -# TODO(cpp-cabrera): perhaps validate this further using jsonschema's -# uri validator as per rfc3987 patch_uri = { 'type': 'object', 'properties': { 'uri': { - 'type': 'string' + 'type': 'string', + 'minLength': 0, + 'maxLength': 255, + 'format': 'uri' }, 'additionalProperties': False } @@ -41,7 +41,9 @@ patch_uri = { patch_group = { 'type': 'object', 'properties': { 'uri': { - 'type': 'string' + 'type': 'string', + 'minLength': 0, + 'maxLength': 255 }, 'additionalProperties': False } diff --git a/zaqar/tests/unit/transport/wsgi/v1/test_pools.py b/zaqar/tests/unit/transport/wsgi/v1/test_pools.py index a194991fd..bea108939 100644 --- a/zaqar/tests/unit/transport/wsgi/v1/test_pools.py +++ b/zaqar/tests/unit/transport/wsgi/v1/test_pools.py @@ -63,12 +63,13 @@ def pools(test, count, uri): :returns: (paths, weights, uris, options) :rtype: ([six.text_type], [int], [six.text_type], [dict]) """ + mongo_url = uri base = test.url_prefix + '/pools/' args = [(base + str(i), i, {str(i): i}) for i in range(count)] for path, weight, option in args: - uri = "%s/%s" % (uri, str(uuid.uuid4())) + uri = "%s/%s" % (mongo_url, str(uuid.uuid4())) doc = {'weight': weight, 'uri': uri, 'options': option} test.simulate_put(path, body=jsonutils.dumps(doc)) diff --git a/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py b/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py index af91f434f..038bc2805 100644 --- a/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py +++ b/zaqar/tests/unit/transport/wsgi/v1_1/test_pools.py @@ -65,12 +65,13 @@ def pools(test, count, uri, group): :returns: (paths, weights, uris, options) :rtype: ([six.text_type], [int], [six.text_type], [dict]) """ + mongo_url = uri base = test.url_prefix + '/pools/' args = [(base + str(i), i, {str(i): i}) for i in range(count)] for path, weight, option in args: - uri = "%s/%s" % (uri, str(uuid.uuid4())) + uri = "%s/%s" % (mongo_url, str(uuid.uuid4())) doc = {'weight': weight, 'uri': uri, 'group': group, 'options': option} test.simulate_put(path, body=jsonutils.dumps(doc)) diff --git a/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py b/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py index 80a7414c9..95e7bdec3 100644 --- a/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py +++ b/zaqar/tests/unit/transport/wsgi/v2_0/test_pools.py @@ -64,12 +64,13 @@ def pools(test, count, uri, group): :returns: (paths, weights, uris, options) :rtype: ([six.text_type], [int], [six.text_type], [dict]) """ + mongo_url = uri base = test.url_prefix + '/pools/' args = [(base + str(i), i, {str(i): i}) for i in range(count)] for path, weight, option in args: - uri = "%s/%s" % (uri, str(uuid.uuid4())) + uri = "%s/%s" % (mongo_url, str(uuid.uuid4())) doc = {'weight': weight, 'uri': uri, 'group': group, 'options': option} test.simulate_put(path, body=jsonutils.dumps(doc))