moto/tests
Benjamin Brabant 7c7a1222d2
Fix saml-assertion parsing in assume-role-with-saml (#3523)
* Retrieve SAML Attribute by Name instead of relying on order which is too fragile

* Handle case when SAML Attribute SessionDuration is not provided, as it is not a required attribute from SAML response

When session duration not provided, AWS consider by default a duration of one hour as cited in the following documentation:
"If this attribute is not present, then the credential last for one hour (the default value of the DurationSeconds parameter of the AssumeRoleWithSAML API)."
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_assertions.html#saml_role-session-duration

Traceback was:
[...]
  File "/Users/benjamin.brabant/Projects/PERSO/moto/moto/sts/responses.py", line 79, in assume_role_with_saml
    role = sts_backend.assume_role_with_saml(
  File "/Users/benjamin.brabant/Projects/PERSO/moto/moto/sts/models.py", line 99, in assume_role_with_saml
    role = AssumedRole(**kwargs)
TypeError: __init__() missing 1 required positional argument: 'duration'

* Process saml xml namespaces properly instead of relying on textual prefix that can vary between identity providers

* Handle when SAML response AttributeValue xml tag contains attributes that force xmltodict to build a dictionary as for complex types instead of directly returning string value

Leverage force_cdata option of xmltodict parser that always return a complex dictionary even if xml tag contains only text and no attributes.

* Improve existing test_assume_role_with_saml to be coherent with other assume_role_with_saml tests and remove dead code at the same time
2020-12-08 09:08:40 +00:00
..
test_acm Linting 2020-11-11 15:55:37 +00:00
test_apigateway Linting 2020-11-11 15:55:37 +00:00
test_applicationautoscaling Linting 2020-11-11 15:55:37 +00:00
test_athena Linting 2020-11-11 15:55:37 +00:00
test_autoscaling Linting 2020-11-11 15:55:37 +00:00
test_awslambda fixed issue in update_configuration for lambda when setting VPC config property (#3479) 2020-11-18 08:45:31 +00:00
test_batch Fix Race Condition in batch:SubmitJob (#3480) 2020-11-18 10:49:25 +00:00
test_cloudformation Fix:Cloudformation descibe stacks special chars (#3514) 2020-12-06 08:11:52 +00:00
test_cloudwatch Fix:CloudWatch List metrics with dimensions (#3461) 2020-11-20 12:38:48 +00:00
test_codecommit Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
test_codepipeline Linting 2020-11-11 15:55:37 +00:00
test_cognitoidentity Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
test_cognitoidp fix SALT and SRP_B params 2020-12-03 11:42:10 +01:00
test_config Linting 2020-11-11 15:55:37 +00:00
test_core Linting 2020-11-11 15:55:37 +00:00
test_datapipeline Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_datasync Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
test_dynamodb Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_dynamodb2 #3506 - DynamoDB - Allow StringSets to be passed to update_item() (#3519) 2020-12-07 09:31:53 +00:00
test_dynamodbstreams Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_ec2 Fix:Ec2-VPC:Added functionality describe-vpc-endpoint (#3524) 2020-12-07 21:39:57 +00:00
test_ec2instanceconnect Improve implementation coverage (and layout) 2020-05-12 14:58:35 +01:00
test_ecr Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_ecs Linting 2020-11-11 15:55:37 +00:00
test_elasticbeanstalk Fix: elasticbeanstalk ApplicationArn does not contain ApplicationName (#3511) 2020-12-04 10:31:28 +00:00
test_elb Back to Black 2020-11-10 14:12:38 +01:00
test_elbv2 Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
test_emr Fix: EMR ReleaseLabel validation does not respect semantic versioning (#3489) 2020-11-22 18:54:59 +00:00
test_events EventBridge: put_rule and list_rules should store and retrieve EventBusName property (#3472) 2020-11-17 15:36:17 +00:00
test_forecast Linting 2020-11-11 15:55:37 +00:00
test_glacier Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_glue Back to Black 2020-11-10 14:12:38 +01:00
test_iam Refactor tests marked xfail to use proper assertions (#3515) 2020-12-04 16:00:48 +00:00
test_iot Linting 2020-11-11 15:55:37 +00:00
test_iotdata Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
test_kinesis Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_kinesisvideo Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_kinesisvideoarchivedmedia Linting 2020-11-11 15:55:37 +00:00
test_kms Linting 2020-11-11 15:55:37 +00:00
test_logs Linting 2020-11-11 15:55:37 +00:00
test_managedblockchain Linting 2020-11-11 15:55:37 +00:00
test_opsworks Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_organizations Linting 2020-11-11 15:55:37 +00:00
test_packages Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_polly Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_ram Finish porting from nose to pytest. 2020-11-10 08:25:05 +01:00
test_rds Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_rds2 Fix:RDS:add DBParameterGroupArn in describe-db-parameter-groups & cre… (#3462) 2020-12-01 19:53:01 +00:00
test_redshift Fix: ClusterType, NumberOfNodes not validated when modifying Redshift cluster (#3513) 2020-12-04 13:22:19 +00:00
test_resourcegroups Run black on moto & test directories. 2019-10-31 10:36:05 -07:00
test_resourcegroupstaggingapi Add ec2.vpc resource support to Tagging API (#3375) 2020-10-10 19:05:21 +01:00
test_route53 Route53: Implement dummy GetChange endpoint (#3486) 2020-11-20 07:21:05 +00:00
test_s3 Linting 2020-11-11 15:55:37 +00:00
test_s3bucket_path Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_sagemaker Back to Black 2020-11-10 14:12:38 +01:00
test_secretsmanager Linting 2020-11-11 15:55:37 +00:00
test_ses Fix:SES:Get Template Html part (#3504) 2020-12-03 07:42:19 +00:00
test_sns Linting 2020-11-11 15:55:37 +00:00
test_sqs Linting 2020-11-11 15:55:37 +00:00
test_ssm Linting 2020-11-11 15:55:37 +00:00
test_stepfunctions Add basic get_execution_history implementation for Step Functions (#3507) 2020-12-03 18:32:06 +00:00
test_sts Fix saml-assertion parsing in assume-role-with-saml (#3523) 2020-12-08 09:08:40 +00:00
test_swf Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
test_transcribe Linting 2020-11-11 15:55:37 +00:00
test_utilities Use TaggingService for S3 Objects 2020-03-31 12:04:04 +01:00
test_xray Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
__init__.py Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00
helpers.py Port test suite from nose to pytest. 2020-11-10 08:23:44 +01:00