Support all ELBv2 ListenerRule condition types (#4066)
* ELBv2 - ListenerRule condition validation - ListenerRule condition model now uses upper case field names that match input params for boto and CloudFormation. - BaseResponse._get_params() introduced to make it easier to deal with the querystring input params.
This commit is contained in:
parent
54b98d4749
commit
85dc52bd84
6 changed files with 755 additions and 80 deletions
|
|
@ -2,6 +2,8 @@ from __future__ import unicode_literals
|
|||
|
||||
import sure # noqa
|
||||
|
||||
from moto.compat import OrderedDict
|
||||
|
||||
from botocore.awsrequest import AWSPreparedRequest
|
||||
|
||||
from moto.core.responses import AWSServiceSpec, BaseResponse
|
||||
|
|
@ -92,3 +94,56 @@ def test_parse_qs_unicode_decode_error():
|
|||
body = b'{"key": "%D0"}, "C": "#0 = :0"}'
|
||||
request = AWSPreparedRequest("GET", "http://request", {"foo": "bar"}, body, False)
|
||||
BaseResponse().setup_class(request, request.url, request.headers)
|
||||
|
||||
|
||||
def test_get_params():
|
||||
subject = BaseResponse()
|
||||
subject.querystring = OrderedDict(
|
||||
[
|
||||
("Action", ["CreateRule"]),
|
||||
("Version", ["2015-12-01"]),
|
||||
(
|
||||
"ListenerArn",
|
||||
[
|
||||
"arn:aws:elasticloadbalancing:us-east-1:1:listener/my-lb/50dc6c495c0c9188/80139731473870416"
|
||||
],
|
||||
),
|
||||
("Priority", ["100"]),
|
||||
("Conditions.member.1.Field", ["http-header"]),
|
||||
("Conditions.member.1.HttpHeaderConfig.HttpHeaderName", ["User-Agent"]),
|
||||
("Conditions.member.1.HttpHeaderConfig.Values.member.2", ["curl"]),
|
||||
("Conditions.member.1.HttpHeaderConfig.Values.member.1", ["Mozilla"]),
|
||||
("Actions.member.1.FixedResponseConfig.StatusCode", ["200"]),
|
||||
("Actions.member.1.FixedResponseConfig.ContentType", ["text/plain"]),
|
||||
("Actions.member.1.Type", ["fixed-response"]),
|
||||
]
|
||||
)
|
||||
|
||||
result = subject._get_params()
|
||||
|
||||
result.should.equal(
|
||||
{
|
||||
"Action": "CreateRule",
|
||||
"Version": "2015-12-01",
|
||||
"ListenerArn": "arn:aws:elasticloadbalancing:us-east-1:1:listener/my-lb/50dc6c495c0c9188/80139731473870416",
|
||||
"Priority": "100",
|
||||
"Conditions": [
|
||||
{
|
||||
"Field": "http-header",
|
||||
"HttpHeaderConfig": {
|
||||
"HttpHeaderName": "User-Agent",
|
||||
"Values": ["Mozilla", "curl"],
|
||||
},
|
||||
}
|
||||
],
|
||||
"Actions": [
|
||||
{
|
||||
"Type": "fixed-response",
|
||||
"FixedResponseConfig": {
|
||||
"StatusCode": "200",
|
||||
"ContentType": "text/plain",
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue