Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Merge "Reduces the min length for rules to 1 character"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Feb 3, 2015
2 parents c255e73 + 72ede29 commit c1429c1
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 12 deletions.
24 changes: 12 additions & 12 deletions poppy/transport/validators/schemas/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256
},
'request_url': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 1024
}
}
Expand Down Expand Up @@ -145,13 +145,13 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256,
},
'request_url': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 1024,
}
}
Expand All @@ -172,7 +172,7 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256},
'ttl': {
'type': 'integer',
Expand All @@ -187,12 +187,12 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256},
'request_url': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 1024}}},
}},
}],
Expand All @@ -207,7 +207,7 @@ class ServiceSchema(schema_base.SchemaBase):
re.IGNORECASE
),
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256},
'ttl': {
'type': 'integer',
Expand All @@ -223,12 +223,12 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256},
'request_url': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 1024}}},
}},
},
Expand All @@ -242,7 +242,7 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256},
'rules': {
'type': 'array',
Expand All @@ -253,7 +253,7 @@ class ServiceSchema(schema_base.SchemaBase):
'name': {
'type': 'string',
'required': True,
'minLength': 3,
'minLength': 1,
'maxLength': 256},
'referrer': {
'type': 'string',
Expand Down
56 changes: 56 additions & 0 deletions tests/api/services/data_patch_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
"rules": [{"name" : "origin", "request_url" : "/origin.htm"}]}
}
],
"add_origin_with_minimum_length_rule_name": [
{"op": "add",
"path": "/origins/1",
"value": {"origin": "1.2.3.4", "port": 80, "ssl": false,
"rules": [{"name" : "o", "request_url" : "/origin.html"}]}
}
],
"add_origin_with_minimum_length_request_url": [
{"op": "add",
"path": "/origins/1",
"value": {"origin": "1.2.3.4", "port": 80, "ssl": false,
"rules": [{"name" : "origin", "request_url" : "/"}]}
}
],
"add_multiple_origins": [
{"op": "add",
"path": "/origins/1",
Expand Down Expand Up @@ -73,6 +87,24 @@
"value": {"name": "cache_name", "ttl": 111,
"rules": [{"name" : "index","request_url" : "/cats.jpg"}]}}
],
"add_caching_with_minimum_length_name": [
{"op": "add",
"path": "/caching/-",
"value": {"name": "c", "ttl": 111,
"rules": [{"name" : "index","request_url" : "/minimum_length_name.htm"}]}}
],
"add_caching_with_minimum_length_rule_name": [
{"op": "add",
"path": "/caching/-",
"value": {"name": "cache_name", "ttl": 111,
"rules": [{"name" : "i","request_url" : "/minimum_length_rule_name.htm"}]}}
],
"add_caching_with_minimum_length_request_url": [
{"op": "add",
"path": "/caching/-",
"value": {"name": "cache_name", "ttl": 111,
"rules": [{"name" : "index","request_url" : "/"}]}}
],
"replace_caching": [
{"op": "replace",
"path": "/caching/0",
Expand Down Expand Up @@ -105,5 +137,29 @@
"remove_restrictions": [
{"op": "remove",
"path": "/restrictions/0"}
],
"add_restrictions_with_minimum_length_name": [
{"op": "add",
"path": "/restrictions/-",
"value": {"name": "r",
"rules": [{"name": "rule1", "referrer": "thesite"}]
}
}
],
"add_restrictions_with_minimum_length_rule_name": [
{"op": "add",
"path": "/restrictions/-",
"value": {"name": "restricted",
"rules": [{"name": "r", "referrer": "thesite"}]
}
}
],
"add_restrictions_with_minimum_length_referrer": [
{"op": "add",
"path": "/restrictions/-",
"value": {"name": "restricted",
"rules": [{"name": "rule1", "referrer": "abc"}]
}
}
]
}
56 changes: 56 additions & 0 deletions tests/api/services/data_patch_service_negative.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,61 @@
{"op": "replace",
"path": "/flavor_id",
"value": "nonexistant"}
],
"add_origin_with_empty_rule_name": [
{"op": "add",
"path": "/origins/1",
"value": {"origin": "1.2.3.4", "port": 80, "ssl": false,
"rules": [{"name" : "", "request_url" : "/origin.html"}]}
}
],
"add_origin_with_empty_request_url": [
{"op": "add",
"path": "/origins/1",
"value": {"origin": "1.2.3.4", "port": 80, "ssl": false,
"rules": [{"name" : "origin", "request_url" : ""}]}
}
],
"add_caching_with_empty_name": [
{"op": "add",
"path": "/caching/-",
"value": {"name": "", "ttl": 111,
"rules": [{"name" : "index","request_url" : "/empty_name.htm"}]}}
],
"add_caching_with_empty_rule_name": [
{"op": "add",
"path": "/caching/-",
"value": {"name": "cache_name", "ttl": 111,
"rules": [{"name" : "","request_url" : "/empty_rule_name.htm"}]}}
],
"add_caching_with_empty_request_url": [
{"op": "add",
"path": "/caching/-",
"value": {"name": "cache_name", "ttl": 111,
"rules": [{"name" : "index","request_url" : ""}]}}
],
"add_restrictions_with_empty_name": [
{"op": "add",
"path": "/restrictions/-",
"value": {"name": "",
"rules": [{"name": "rule1", "referrer": "thesite"}]
}
}
],
"add_restrictions_with_empty_rule_name": [
{"op": "add",
"path": "/restrictions/-",
"value": {"name": "restricted",
"rules": [{"name": "", "referrer": "thesite"}]
}
}
],
"add_restrictions_with_less_than_minimum_length_referrer": [
{"op": "add",
"path": "/restrictions/-",
"value": {"name": "restricted",
"rules": [{"name": "rule1", "referrer": "ab"}]
}
}
]
}

0 comments on commit c1429c1

Please sign in to comment.