Merge branch 'master' into dynamodb-gsi-projectiontype
This commit is contained in:
commit
06b390b493
8 changed files with 198 additions and 99 deletions
|
|
@ -96,6 +96,25 @@ def test_boto3_yaml_validate_successful():
|
|||
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
@mock_s3
|
||||
def test_boto3_yaml_validate_template_url_successful():
|
||||
s3 = boto3.client("s3")
|
||||
s3_conn = boto3.resource("s3", region_name="us-east-1")
|
||||
s3_conn.create_bucket(Bucket="foobar")
|
||||
|
||||
s3_conn.Object("foobar", "template-key").put(Body=yaml_template)
|
||||
key_url = s3.generate_presigned_url(
|
||||
ClientMethod="get_object", Params={"Bucket": "foobar", "Key": "template-key"}
|
||||
)
|
||||
|
||||
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
|
||||
response = cf_conn.validate_template(TemplateURL=key_url)
|
||||
assert response["Description"] == "Simple CloudFormation Test Template"
|
||||
assert response["Parameters"] == []
|
||||
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
def test_boto3_yaml_invalid_missing_resource():
|
||||
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
|
||||
|
|
|
|||
|
|
@ -1243,6 +1243,38 @@ def test_change_password():
|
|||
result["AuthenticationResult"].should_not.be.none
|
||||
|
||||
|
||||
@mock_cognitoidp
|
||||
def test_change_password__using_custom_user_agent_header():
|
||||
# https://github.com/spulec/moto/issues/3098
|
||||
# As the admin_initiate_auth-method is unauthenticated, we use the user-agent header to pass in the region
|
||||
# This test verifies this works, even if we pass in our own user-agent header
|
||||
from botocore.config import Config
|
||||
|
||||
my_config = Config(user_agent_extra="more/info", signature_version="v4")
|
||||
conn = boto3.client("cognito-idp", "us-west-2", config=my_config)
|
||||
|
||||
outputs = authentication_flow(conn)
|
||||
|
||||
# Take this opportunity to test change_password, which requires an access token.
|
||||
newer_password = str(uuid.uuid4())
|
||||
conn.change_password(
|
||||
AccessToken=outputs["access_token"],
|
||||
PreviousPassword=outputs["password"],
|
||||
ProposedPassword=newer_password,
|
||||
)
|
||||
|
||||
# Log in again, which should succeed without a challenge because the user is no
|
||||
# longer in the force-new-password state.
|
||||
result = conn.admin_initiate_auth(
|
||||
UserPoolId=outputs["user_pool_id"],
|
||||
ClientId=outputs["client_id"],
|
||||
AuthFlow="ADMIN_NO_SRP_AUTH",
|
||||
AuthParameters={"USERNAME": outputs["username"], "PASSWORD": newer_password},
|
||||
)
|
||||
|
||||
result["AuthenticationResult"].should_not.be.none
|
||||
|
||||
|
||||
@mock_cognitoidp
|
||||
def test_forgot_password():
|
||||
conn = boto3.client("cognito-idp", "us-west-2")
|
||||
|
|
|
|||
|
|
@ -994,12 +994,17 @@ def test_handle_listener_rules():
|
|||
priority = 100
|
||||
host = "xxx.example.com"
|
||||
path_pattern = "foobar"
|
||||
pathpatternconfig_pattern = "foobar2"
|
||||
created_rule = conn.create_rule(
|
||||
ListenerArn=http_listener_arn,
|
||||
Priority=priority,
|
||||
Conditions=[
|
||||
{"Field": "host-header", "Values": [host]},
|
||||
{"Field": "path-pattern", "Values": [path_pattern]},
|
||||
{
|
||||
"Field": "path-pattern",
|
||||
"PathPatternConfig": {"Values": [pathpatternconfig_pattern]},
|
||||
},
|
||||
],
|
||||
Actions=[
|
||||
{"TargetGroupArn": target_group.get("TargetGroupArn"), "Type": "forward"}
|
||||
|
|
@ -1017,6 +1022,10 @@ def test_handle_listener_rules():
|
|||
Conditions=[
|
||||
{"Field": "host-header", "Values": [host]},
|
||||
{"Field": "path-pattern", "Values": [path_pattern]},
|
||||
{
|
||||
"Field": "path-pattern",
|
||||
"PathPatternConfig": {"Values": [pathpatternconfig_pattern]},
|
||||
},
|
||||
],
|
||||
Actions=[
|
||||
{"TargetGroupArn": target_group.get("TargetGroupArn"), "Type": "forward"}
|
||||
|
|
@ -1031,6 +1040,10 @@ def test_handle_listener_rules():
|
|||
Conditions=[
|
||||
{"Field": "host-header", "Values": [host]},
|
||||
{"Field": "path-pattern", "Values": [path_pattern]},
|
||||
{
|
||||
"Field": "path-pattern",
|
||||
"PathPatternConfig": {"Values": [pathpatternconfig_pattern]},
|
||||
},
|
||||
],
|
||||
Actions=[
|
||||
{
|
||||
|
|
@ -1079,11 +1092,16 @@ def test_handle_listener_rules():
|
|||
# modify rule partially
|
||||
new_host = "new.example.com"
|
||||
new_path_pattern = "new_path"
|
||||
new_pathpatternconfig_pattern = "new_path2"
|
||||
modified_rule = conn.modify_rule(
|
||||
RuleArn=first_rule["RuleArn"],
|
||||
Conditions=[
|
||||
{"Field": "host-header", "Values": [new_host]},
|
||||
{"Field": "path-pattern", "Values": [new_path_pattern]},
|
||||
{
|
||||
"Field": "path-pattern",
|
||||
"PathPatternConfig": {"Values": [new_pathpatternconfig_pattern]},
|
||||
},
|
||||
],
|
||||
)["Rules"][0]
|
||||
|
||||
|
|
@ -1092,6 +1110,9 @@ def test_handle_listener_rules():
|
|||
modified_rule.should.equal(obtained_rule)
|
||||
obtained_rule["Conditions"][0]["Values"][0].should.equal(new_host)
|
||||
obtained_rule["Conditions"][1]["Values"][0].should.equal(new_path_pattern)
|
||||
obtained_rule["Conditions"][2]["Values"][0].should.equal(
|
||||
new_pathpatternconfig_pattern
|
||||
)
|
||||
obtained_rule["Actions"][0]["TargetGroupArn"].should.equal(
|
||||
target_group.get("TargetGroupArn")
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue