From 14a69c752477c385d3c80429c719af0aa1cb9d5e Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Mon, 18 Oct 2021 19:44:29 +0000 Subject: [PATCH] Techdebt: Enable pylint rules (#4432) --- moto/__init__.py | 2 - moto/acm/__init__.py | 1 - moto/acm/models.py | 2 - moto/acm/responses.py | 1 - moto/acm/urls.py | 1 - moto/apigateway/__init__.py | 1 - moto/apigateway/exceptions.py | 1 - moto/apigateway/models.py | 1 - moto/apigateway/responses.py | 2 - moto/apigateway/urls.py | 1 - moto/apigateway/utils.py | 1 - moto/applicationautoscaling/__init__.py | 1 - moto/applicationautoscaling/exceptions.py | 1 - moto/applicationautoscaling/models.py | 1 - moto/applicationautoscaling/responses.py | 1 - moto/applicationautoscaling/urls.py | 1 - moto/athena/__init__.py | 1 - moto/athena/exceptions.py | 2 - moto/athena/models.py | 1 - moto/athena/urls.py | 1 - moto/athena/utils.py | 1 - moto/autoscaling/__init__.py | 1 - moto/autoscaling/exceptions.py | 1 - moto/autoscaling/models.py | 2 - moto/autoscaling/responses.py | 1 - moto/autoscaling/urls.py | 1 - moto/awslambda/__init__.py | 1 - moto/awslambda/models.py | 2 - moto/awslambda/policy.py | 2 - moto/awslambda/responses.py | 2 - moto/awslambda/urls.py | 1 - moto/backends.py | 2 - moto/batch/__init__.py | 1 - moto/batch/exceptions.py | 1 - moto/batch/models.py | 1 - moto/batch/responses.py | 1 - moto/batch/urls.py | 1 - moto/batch/utils.py | 3 - moto/cloudformation/__init__.py | 1 - moto/cloudformation/exceptions.py | 1 - moto/cloudformation/models.py | 1 - moto/cloudformation/parsing.py | 1 - moto/cloudformation/responses.py | 2 - moto/cloudformation/urls.py | 1 - moto/cloudformation/utils.py | 1 - moto/cloudwatch/utils.py | 3 - moto/codecommit/urls.py | 1 - moto/codepipeline/urls.py | 1 - moto/cognitoidentity/__init__.py | 1 - moto/cognitoidentity/exceptions.py | 2 - moto/cognitoidentity/models.py | 2 - moto/cognitoidentity/responses.py | 2 - moto/cognitoidentity/urls.py | 1 - moto/cognitoidp/__init__.py | 1 - moto/cognitoidp/exceptions.py | 2 - moto/cognitoidp/models.py | 2 - moto/cognitoidp/responses.py | 2 - moto/cognitoidp/urls.py | 1 - moto/cognitoidp/utils.py | 1 - moto/config/urls.py | 1 - moto/core/__init__.py | 2 - moto/core/exceptions.py | 2 - moto/core/models.py | 1 - moto/core/responses.py | 2 - moto/core/urls.py | 1 - moto/core/utils.py | 25 --- moto/datapipeline/__init__.py | 1 - moto/datapipeline/models.py | 2 - moto/datapipeline/responses.py | 2 - moto/datapipeline/urls.py | 1 - moto/datasync/__init__.py | 2 - moto/datasync/exceptions.py | 2 - moto/datasync/urls.py | 2 - moto/dms/__init__.py | 1 - moto/dms/exceptions.py | 1 - moto/dms/models.py | 2 - moto/dms/responses.py | 1 - moto/dms/urls.py | 1 - moto/dms/utils.py | 3 - moto/dynamodb/__init__.py | 1 - moto/dynamodb/comparisons.py | 2 - moto/dynamodb/models.py | 1 - moto/dynamodb/responses.py | 1 - moto/dynamodb/urls.py | 1 - moto/dynamodb2/__init__.py | 1 - moto/dynamodb2/comparisons.py | 1 - moto/dynamodb2/models/__init__.py | 1 - moto/dynamodb2/responses.py | 2 - moto/dynamodb2/urls.py | 1 - moto/dynamodbstreams/__init__.py | 1 - moto/dynamodbstreams/models.py | 2 - moto/dynamodbstreams/responses.py | 2 - moto/dynamodbstreams/urls.py | 1 - moto/ec2/__init__.py | 1 - moto/ec2/exceptions.py | 1 - moto/ec2/models.py | 2 - moto/ec2/responses/__init__.py | 2 - moto/ec2/responses/account_attributes.py | 1 - moto/ec2/responses/amazon_dev_pay.py | 1 - moto/ec2/responses/amis.py | 1 - .../availability_zones_and_regions.py | 1 - moto/ec2/responses/customer_gateways.py | 1 - moto/ec2/responses/dhcp_options.py | 1 - moto/ec2/responses/elastic_block_store.py | 1 - moto/ec2/responses/elastic_ip_addresses.py | 1 - .../responses/elastic_network_interfaces.py | 1 - moto/ec2/responses/flow_logs.py | 1 - moto/ec2/responses/general.py | 1 - moto/ec2/responses/iam_instance_profiles.py | 1 - moto/ec2/responses/instances.py | 2 - moto/ec2/responses/internet_gateways.py | 1 - moto/ec2/responses/ip_addresses.py | 2 - moto/ec2/responses/key_pairs.py | 1 - moto/ec2/responses/monitoring.py | 1 - moto/ec2/responses/nat_gateways.py | 1 - moto/ec2/responses/network_acls.py | 1 - moto/ec2/responses/placement_groups.py | 1 - moto/ec2/responses/reserved_instances.py | 1 - moto/ec2/responses/route_tables.py | 1 - moto/ec2/responses/security_groups.py | 2 - moto/ec2/responses/spot_fleets.py | 1 - moto/ec2/responses/spot_instances.py | 1 - moto/ec2/responses/subnets.py | 1 - moto/ec2/responses/tags.py | 2 - .../responses/transit_gateway_attachments.py | 1 - .../responses/transit_gateway_route_tables.py | 1 - moto/ec2/responses/transit_gateways.py | 1 - .../ec2/responses/virtual_private_gateways.py | 1 - moto/ec2/responses/vm_export.py | 1 - moto/ec2/responses/vm_import.py | 1 - moto/ec2/responses/vpc_peering_connections.py | 1 - moto/ec2/responses/vpcs.py | 1 - moto/ec2/responses/vpn_connections.py | 1 - moto/ec2/responses/windows.py | 1 - moto/ec2/urls.py | 1 - moto/ec2/utils.py | 2 - moto/ec2instanceconnect/urls.py | 1 - moto/ecr/__init__.py | 1 - moto/ecr/exceptions.py | 1 - moto/ecr/models.py | 2 - moto/ecr/responses.py | 1 - moto/ecr/urls.py | 1 - moto/ecs/__init__.py | 1 - moto/ecs/exceptions.py | 1 - moto/ecs/models.py | 2 - moto/ecs/responses.py | 1 - moto/ecs/urls.py | 1 - moto/efs/__init__.py | 2 - moto/efs/exceptions.py | 2 - moto/efs/models.py | 2 - moto/efs/responses.py | 2 - moto/efs/urls.py | 2 - moto/eks/__init__.py | 2 - moto/eks/exceptions.py | 2 - moto/eks/models.py | 2 - moto/eks/responses.py | 2 - moto/eks/urls.py | 2 - moto/elasticbeanstalk/urls.py | 2 - moto/elastictranscoder/__init__.py | 1 - moto/elastictranscoder/models.py | 1 - moto/elastictranscoder/responses.py | 1 - moto/elastictranscoder/urls.py | 1 - moto/elb/__init__.py | 1 - moto/elb/exceptions.py | 1 - moto/elb/models.py | 2 - moto/elb/responses.py | 1 - moto/elb/urls.py | 1 - moto/elbv2/__init__.py | 1 - moto/elbv2/exceptions.py | 1 - moto/elbv2/models.py | 2 - moto/elbv2/responses.py | 1 - moto/elbv2/urls.py | 1 - moto/emr/__init__.py | 1 - moto/emr/exceptions.py | 2 - moto/emr/models.py | 1 - moto/emr/responses.py | 1 - moto/emr/urls.py | 1 - moto/emr/utils.py | 1 - moto/events/__init__.py | 2 - moto/events/exceptions.py | 1 - moto/events/urls.py | 2 - moto/forecast/__init__.py | 2 - moto/forecast/exceptions.py | 2 - moto/forecast/responses.py | 2 - moto/forecast/urls.py | 2 - moto/glacier/__init__.py | 1 - moto/glacier/models.py | 2 - moto/glacier/responses.py | 2 - moto/glacier/urls.py | 1 - moto/glue/__init__.py | 1 - moto/glue/exceptions.py | 1 - moto/glue/models.py | 2 - moto/glue/responses.py | 2 - moto/glue/urls.py | 2 - moto/glue/utils.py | 1 - moto/iam/__init__.py | 1 - moto/iam/exceptions.py | 1 - moto/iam/models.py | 1 - moto/iam/responses.py | 2 - moto/iam/urls.py | 1 - moto/iam/utils.py | 1 - moto/instance_metadata/__init__.py | 1 - moto/instance_metadata/responses.py | 1 - moto/instance_metadata/urls.py | 1 - moto/iot/__init__.py | 1 - moto/iot/exceptions.py | 1 - moto/iot/models.py | 2 - moto/iot/responses.py | 2 - moto/iot/urls.py | 1 - moto/iotdata/__init__.py | 1 - moto/iotdata/exceptions.py | 1 - moto/iotdata/models.py | 1 - moto/iotdata/responses.py | 1 - moto/iotdata/urls.py | 1 - moto/kinesis/__init__.py | 1 - moto/kinesis/exceptions.py | 2 - moto/kinesis/models.py | 2 - moto/kinesis/responses.py | 2 - moto/kinesis/urls.py | 1 - moto/kinesisvideo/__init__.py | 1 - moto/kinesisvideo/exceptions.py | 2 - moto/kinesisvideo/models.py | 1 - moto/kinesisvideo/responses.py | 1 - moto/kinesisvideo/urls.py | 1 - moto/kinesisvideoarchivedmedia/__init__.py | 1 - moto/kinesisvideoarchivedmedia/exceptions.py | 2 - moto/kinesisvideoarchivedmedia/models.py | 1 - moto/kinesisvideoarchivedmedia/responses.py | 1 - moto/kinesisvideoarchivedmedia/urls.py | 1 - moto/kms/__init__.py | 1 - moto/kms/exceptions.py | 1 - moto/kms/models.py | 2 - moto/kms/responses.py | 2 - moto/kms/urls.py | 1 - moto/kms/utils.py | 2 - moto/logs/exceptions.py | 1 - moto/managedblockchain/__init__.py | 1 - moto/managedblockchain/exceptions.py | 1 - moto/managedblockchain/models.py | 2 +- moto/managedblockchain/responses.py | 2 - moto/managedblockchain/urls.py | 1 - moto/mediaconnect/__init__.py | 1 - moto/mediaconnect/exceptions.py | 1 - moto/mediaconnect/models.py | 2 - moto/mediaconnect/responses.py | 2 - moto/mediaconnect/urls.py | 1 - moto/medialive/__init__.py | 1 - moto/medialive/exceptions.py | 1 - moto/medialive/models.py | 2 - moto/medialive/responses.py | 1 - moto/medialive/urls.py | 1 - moto/mediapackage/__init__.py | 1 - moto/mediapackage/exceptions.py | 2 - moto/mediapackage/models.py | 2 - moto/mediapackage/responses.py | 1 - moto/mediapackage/urls.py | 1 - moto/mediastore/__init__.py | 1 - moto/mediastore/exceptions.py | 2 - moto/mediastore/models.py | 2 - moto/mediastore/responses.py | 2 - moto/mediastore/urls.py | 2 - moto/mediastoredata/__init__.py | 1 - moto/mediastoredata/exceptions.py | 2 - moto/mediastoredata/models.py | 2 - moto/mediastoredata/responses.py | 2 - moto/mediastoredata/urls.py | 2 - moto/opsworks/__init__.py | 1 - moto/opsworks/exceptions.py | 2 - moto/opsworks/models.py | 1 - moto/opsworks/responses.py | 2 - moto/opsworks/urls.py | 1 - moto/organizations/__init__.py | 1 - moto/organizations/exceptions.py | 1 - moto/organizations/models.py | 2 - moto/organizations/responses.py | 1 - moto/organizations/urls.py | 1 - moto/organizations/utils.py | 2 - moto/polly/__init__.py | 1 - moto/polly/models.py | 1 - moto/polly/responses.py | 2 - moto/polly/urls.py | 1 - moto/polly/utils.py | 3 - moto/ram/exceptions.py | 1 - moto/ram/responses.py | 1 - moto/ram/urls.py | 1 - moto/rds/__init__.py | 1 - moto/rds/exceptions.py | 2 - moto/rds/models.py | 2 - moto/rds/responses.py | 2 - moto/rds/urls.py | 1 - moto/rds2/__init__.py | 1 - moto/rds2/exceptions.py | 2 - moto/rds2/models.py | 2 - moto/rds2/responses.py | 1 - moto/rds2/urls.py | 1 - moto/rds2/utils.py | 2 - moto/redshift/__init__.py | 1 - moto/redshift/exceptions.py | 2 - moto/redshift/models.py | 2 - moto/redshift/responses.py | 2 - moto/redshift/urls.py | 1 - moto/redshift/utils.py | 1 - moto/resourcegroups/__init__.py | 1 - moto/resourcegroups/exceptions.py | 1 - moto/resourcegroups/models.py | 1 - moto/resourcegroups/responses.py | 1 - moto/resourcegroups/urls.py | 1 - moto/resourcegroupstaggingapi/__init__.py | 1 - moto/resourcegroupstaggingapi/models.py | 1 - moto/resourcegroupstaggingapi/responses.py | 1 - moto/resourcegroupstaggingapi/urls.py | 1 - moto/route53/__init__.py | 1 - moto/route53/models.py | 2 - moto/route53/responses.py | 1 - moto/route53/urls.py | 1 - moto/s3/__init__.py | 1 - moto/s3/exceptions.py | 2 - moto/s3/models.py | 1 - moto/s3/responses.py | 17 +- moto/s3/urls.py | 2 - moto/s3/utils.py | 1 - moto/s3bucket_path/__init__.py | 1 - moto/s3bucket_path/utils.py | 1 - moto/sagemaker/__init__.py | 1 - moto/sagemaker/exceptions.py | 1 - moto/sagemaker/models.py | 2 - moto/sagemaker/responses.py | 2 - moto/sagemaker/urls.py | 1 - moto/secretsmanager/__init__.py | 1 - moto/secretsmanager/exceptions.py | 1 - moto/secretsmanager/models.py | 3 - moto/secretsmanager/responses.py | 2 - moto/secretsmanager/urls.py | 1 - moto/secretsmanager/utils.py | 2 - moto/server.py | 2 - moto/ses/__init__.py | 1 - moto/ses/exceptions.py | 1 - moto/ses/models.py | 2 - moto/ses/responses.py | 1 - moto/ses/urls.py | 1 - moto/ses/utils.py | 1 - moto/sns/__init__.py | 1 - moto/sns/exceptions.py | 1 - moto/sns/models.py | 2 - moto/sns/responses.py | 1 - moto/sns/urls.py | 1 - moto/sns/utils.py | 1 - moto/sqs/__init__.py | 1 - moto/sqs/exceptions.py | 1 - moto/sqs/models.py | 2 - moto/sqs/responses.py | 2 - moto/sqs/urls.py | 1 - moto/sqs/utils.py | 1 - moto/ssm/__init__.py | 1 - moto/ssm/exceptions.py | 1 - moto/ssm/models.py | 2 - moto/ssm/responses.py | 1 - moto/ssm/urls.py | 1 - moto/stepfunctions/__init__.py | 1 - moto/stepfunctions/exceptions.py | 1 - moto/stepfunctions/responses.py | 2 - moto/stepfunctions/urls.py | 1 - moto/sts/__init__.py | 1 - moto/sts/exceptions.py | 1 - moto/sts/models.py | 1 - moto/sts/responses.py | 2 - moto/sts/urls.py | 1 - moto/support/__init__.py | 1 - moto/support/exceptions.py | 1 - moto/support/models.py | 1 - moto/support/responses.py | 1 - moto/support/urls.py | 1 - moto/swf/__init__.py | 1 - moto/swf/exceptions.py | 2 - moto/swf/models/__init__.py | 2 - moto/swf/models/activity_task.py | 1 - moto/swf/models/decision_task.py | 1 - moto/swf/models/domain.py | 1 - moto/swf/models/generic_type.py | 2 - moto/swf/models/history_event.py | 2 - moto/swf/models/workflow_execution.py | 1 - moto/transcribe/__init__.py | 2 - moto/transcribe/responses.py | 2 - moto/transcribe/urls.py | 2 - moto/wafv2/__init__.py | 2 - moto/wafv2/exceptions.py | 1 - moto/wafv2/models.py | 1 - moto/wafv2/responses.py | 1 - moto/wafv2/urls.py | 2 - moto/xray/__init__.py | 1 - moto/xray/models.py | 2 - moto/xray/responses.py | 1 - moto/xray/urls.py | 1 - setup.cfg | 2 +- setup.py | 1 - tests/__init__.py | 2 - tests/helpers.py | 1 - tests/test_acm/test_acm.py | 5 +- tests/test_apigateway/test_apigateway.py | 53 +++--- .../test_apigateway_cloudformation.py | 3 +- .../test_apigateway_validators.py | 3 +- tests/test_apigateway/test_server.py | 3 +- tests/test_applicationautoscaling/__init__.py | 1 - .../test_applicationautoscaling.py | 5 +- .../test_validation.py | 61 +++--- tests/test_athena/test_athena.py | 4 +- tests/test_autoscaling/test_autoscaling.py | 23 +-- .../test_autoscaling_cloudformation.py | 2 +- tests/test_autoscaling/test_elbv2.py | 5 +- .../test_launch_configurations.py | 4 +- tests/test_autoscaling/test_policies.py | 3 +- tests/test_autoscaling/test_server.py | 3 +- tests/test_autoscaling/utils.py | 1 - .../test_awslambda_cloudformation.py | 8 +- tests/test_awslambda/test_lambda.py | 6 +- .../test_awslambda/test_lambda_concurrency.py | 2 +- .../test_lambda_eventsourcemapping.py | 2 +- tests/test_awslambda/test_lambda_invoke.py | 2 +- tests/test_awslambda/test_lambda_layers.py | 2 +- tests/test_awslambda/test_policy.py | 4 +- tests/test_batch/test_batch_cloudformation.py | 16 +- tests/test_batch/test_batch_compute_envs.py | 28 ++- tests/test_batch/test_batch_job_queue.py | 28 +-- tests/test_batch/test_batch_jobs.py | 42 ++--- .../test_batch/test_batch_task_definition.py | 14 +- tests/test_batch/test_server.py | 4 +- tests/test_cloudformation/__init__.py | 1 - .../test_cloudformation/fixtures/__init__.py | 1 - .../fixtures/ec2_classic_eip.py | 2 - tests/test_cloudformation/fixtures/fn_join.py | 2 - tests/test_cloudformation/fixtures/kms_key.py | 2 - .../rds_mysql_with_db_parameter_group.py | 2 - .../fixtures/rds_mysql_with_read_replica.py | 2 - .../test_cloudformation/fixtures/redshift.py | 2 - .../route53_ec2_instance_with_public_ip.py | 2 - .../fixtures/route53_health_check.py | 2 - .../fixtures/route53_roundrobin.py | 2 - .../single_instance_with_ebs_volume.py | 2 - tests/test_cloudformation/fixtures/vpc_eip.py | 2 - tests/test_cloudformation/fixtures/vpc_eni.py | 2 - .../fixtures/vpc_single_instance_in_subnet.py | 2 - .../test_cloudformation_stack_crud.py | 4 +- .../test_cloudformation_stack_crud_boto3.py | 4 +- .../test_cloudformation_stack_integration.py | 13 +- .../test_cloudformation/test_import_value.py | 3 +- tests/test_cloudformation/test_server.py | 5 +- .../test_cloudformation/test_stack_parsing.py | 4 +- tests/test_cloudformation/test_validate.py | 19 +- tests/test_cloudtrail/test_cloudtrail.py | 10 +- tests/test_cloudtrail/test_server.py | 2 +- tests/test_cloudwatch/test_cloudwatch.py | 7 +- .../test_cloudwatch/test_cloudwatch_alarms.py | 2 +- .../test_cloudwatch/test_cloudwatch_boto3.py | 6 +- .../test_cloudwatch_dashboards.py | 2 +- tests/test_cloudwatch/test_cloudwatch_tags.py | 2 +- tests/test_codecommit/test_codecommit.py | 2 +- tests/test_codepipeline/test_codepipeline.py | 2 +- .../test_cognitoidentity.py | 8 +- tests/test_cognitoidentity/test_server.py | 4 +- tests/test_cognitoidp/test_cognitoidp.py | 46 ++--- tests/test_config/test_config.py | 12 +- tests/test_core/test_auth.py | 2 +- tests/test_core/test_context_manager.py | 2 +- tests/test_core/test_decorator_calls.py | 3 +- tests/test_core/test_environ_patching.py | 2 +- tests/test_core/test_instance_metadata.py | 4 +- tests/test_core/test_moto_api.py | 4 +- tests/test_core/test_nested.py | 3 +- tests/test_core/test_request_mocking.py | 2 +- tests/test_core/test_responses.py | 4 +- tests/test_core/test_server.py | 4 +- tests/test_core/test_url_mapping.py | 3 +- tests/test_core/test_utils.py | 32 ++-- tests/test_datapipeline/test_datapipeline.py | 4 +- .../test_datapipeline_cloudformation.py | 2 +- tests/test_datapipeline/test_server.py | 4 +- tests/test_datasync/test_datasync.py | 52 ++++-- tests/test_dms/test_dms.py | 4 +- tests/test_dynamodb/test_dynamodb.py | 6 +- .../test_dynamodb_table_with_range_key.py | 4 +- .../test_dynamodb_table_without_range_key.py | 4 +- tests/test_dynamodb/test_server.py | 3 +- tests/test_dynamodb2/test_dynamodb.py | 28 +-- .../test_dynamodb_cloudformation.py | 2 +- .../test_dynamodb_condition_expressions.py | 2 +- .../test_dynamodb_consumedcapacity.py | 2 +- .../test_dynamodb_exceptions.py | 2 +- .../test_dynamodb_table_with_range_key.py | 12 +- .../test_dynamodb_table_without_range_key.py | 6 +- .../test_dynamodb_validation.py | 1 - tests/test_dynamodb2/test_server.py | 3 +- .../test_dynamodbstreams.py | 2 +- tests/test_ec2/test_account_attributes.py | 3 +- tests/test_ec2/test_amazon_dev_pay.py | 4 +- tests/test_ec2/test_amis.py | 9 +- .../test_availability_zones_and_regions.py | 3 +- tests/test_ec2/test_carrier_gateways.py | 2 +- tests/test_ec2/test_customer_gateways.py | 7 +- tests/test_ec2/test_dhcp_options.py | 4 +- tests/test_ec2/test_ec2_cloudformation.py | 2 +- tests/test_ec2/test_ec2_core.py | 1 - tests/test_ec2/test_ec2_integration.py | 4 +- tests/test_ec2/test_egress_only_igw.py | 2 +- tests/test_ec2/test_elastic_block_store.py | 40 ++-- tests/test_ec2/test_elastic_ip_addresses.py | 9 +- .../test_elastic_network_interfaces.py | 4 +- tests/test_ec2/test_flow_logs.py | 8 +- .../test_ec2/test_flow_logs_cloudformation.py | 9 +- tests/test_ec2/test_general.py | 5 +- tests/test_ec2/test_iam_integration.py | 8 +- .../test_ec2/test_instance_type_offerings.py | 4 +- tests/test_ec2/test_instance_types.py | 4 +- tests/test_ec2/test_instances.py | 26 ++- tests/test_ec2/test_internet_gateways.py | 22 +-- tests/test_ec2/test_ip_addresses.py | 4 +- tests/test_ec2/test_key_pairs.py | 10 +- tests/test_ec2/test_launch_templates.py | 4 +- tests/test_ec2/test_monitoring.py | 4 +- tests/test_ec2/test_nat_gateway.py | 5 +- tests/test_ec2/test_network_acls.py | 11 +- tests/test_ec2/test_placement_groups.py | 4 +- tests/test_ec2/test_prefix_lists.py | 2 +- tests/test_ec2/test_regions.py | 7 +- tests/test_ec2/test_reserved_instances.py | 4 +- tests/test_ec2/test_route_tables.py | 22 +-- tests/test_ec2/test_security_groups.py | 8 +- .../test_security_groups_cloudformation.py | 3 +- tests/test_ec2/test_server.py | 3 +- tests/test_ec2/test_spot_fleet.py | 4 +- tests/test_ec2/test_spot_instances.py | 6 +- tests/test_ec2/test_subnets.py | 31 ++-- tests/test_ec2/test_tags.py | 6 +- tests/test_ec2/test_transit_gateway.py | 10 +- .../test_transit_gateway_cloudformation.py | 4 +- ...est_transit_gateway_peering_attachments.py | 4 +- .../test_ec2/test_virtual_private_gateways.py | 175 +++++++++--------- tests/test_ec2/test_vm_export.py | 4 +- tests/test_ec2/test_vm_import.py | 4 +- tests/test_ec2/test_vpc_peering.py | 7 +- tests/test_ec2/test_vpcs.py | 11 +- tests/test_ec2/test_vpn_connections.py | 6 +- tests/test_ec2/test_windows.py | 4 +- tests/test_ecr/test_ecr_boto3.py | 8 +- tests/test_ecr/test_ecr_cloudformation.py | 2 +- tests/test_ecr/test_ecr_policy_validation.py | 2 +- tests/test_ecs/test_ecs_boto3.py | 25 +-- tests/test_ecs/test_ecs_cloudformation.py | 2 +- tests/test_efs/test_file_system.py | 2 - tests/test_efs/test_mount_target.py | 2 - tests/test_efs/test_server.py | 2 - tests/test_eks/test_eks.py | 6 +- tests/test_eks/test_server.py | 4 +- tests/test_elasticbeanstalk/test_eb.py | 2 +- .../test_elastictranscoder.py | 4 +- tests/test_elastictranscoder/test_server.py | 4 +- tests/test_elb/test_elb.py | 4 +- tests/test_elb/test_elb_cloudformation.py | 2 +- tests/test_elb/test_server.py | 3 +- tests/test_elbv2/test_elbv2.py | 58 +++--- tests/test_elbv2/test_elbv2_cloudformation.py | 2 +- tests/test_elbv2/test_elbv2_listener_rules.py | 7 +- tests/test_elbv2/test_server.py | 3 +- tests/test_emr/test_emr.py | 5 +- tests/test_emr/test_emr_boto3.py | 8 +- tests/test_emr/test_emr_integration.py | 4 +- tests/test_emr/test_server.py | 3 +- tests/test_events/test_events.py | 2 +- .../test_events/test_events_cloudformation.py | 8 +- tests/test_events/test_events_integration.py | 2 +- .../test_firehose_destination_types.py | 1 + tests/test_forecast/test_forecast.py | 8 +- tests/test_glacier/test_glacier_archives.py | 4 +- tests/test_glacier/test_glacier_jobs.py | 5 +- tests/test_glacier/test_glacier_vaults.py | 4 +- tests/test_glacier/test_server.py | 4 +- tests/test_glue/__init__.py | 1 - tests/test_glue/fixtures/__init__.py | 1 - tests/test_glue/fixtures/datacatalog.py | 2 - tests/test_glue/helpers.py | 18 +- tests/test_glue/test_datacatalog.py | 4 +- tests/test_iam/test_iam.py | 23 +-- tests/test_iam/test_iam_account_aliases.py | 2 +- tests/test_iam/test_iam_cloudformation.py | 19 +- tests/test_iam/test_iam_groups.py | 4 +- tests/test_iam/test_iam_policies.py | 2 +- .../test_iam/test_iam_server_certificates.py | 2 +- tests/test_iam/test_server.py | 6 +- tests/test_iot/test_iot.py | 24 ++- tests/test_iot/test_server.py | 4 +- tests/test_iotdata/test_iotdata.py | 4 +- tests/test_iotdata/test_server.py | 4 +- tests/test_kinesis/test_kinesis.py | 4 +- tests/test_kinesis/test_kinesis_boto3.py | 2 +- .../test_kinesis_cloudformation.py | 2 +- tests/test_kinesis/test_server.py | 8 +- tests/test_kinesisvideo/test_kinesisvideo.py | 5 +- tests/test_kinesisvideo/test_server.py | 4 +- .../test_kinesisvideoarchivedmedia.py | 4 +- .../test_server.py | 4 +- tests/test_kms/test_kms.py | 5 +- tests/test_kms/test_kms_boto3.py | 7 +- tests/test_kms/test_server.py | 4 +- tests/test_kms/test_utils.py | 4 +- tests/test_logs/test_integration.py | 58 +++--- tests/test_logs/test_logs.py | 2 +- tests/test_logs/test_models.py | 2 +- tests/test_managedblockchain/__init__.py | 1 - tests/test_managedblockchain/helpers.py | 3 - .../test_managedblockchain_invitations.py | 4 +- .../test_managedblockchain_members.py | 4 +- .../test_managedblockchain_networks.py | 4 +- .../test_managedblockchain_nodes.py | 4 +- .../test_managedblockchain_proposals.py | 4 +- .../test_managedblockchain_proposalvotes.py | 7 +- tests/test_mediaconnect/test_mediaconnect.py | 4 +- tests/test_mediaconnect/test_server.py | 4 +- tests/test_medialive/test_medialive.py | 10 +- tests/test_medialive/test_server.py | 4 +- tests/test_mediapackage/test_mediapackage.py | 12 +- tests/test_mediapackage/test_server.py | 4 +- tests/test_mediastore/test_mediastore.py | 4 +- tests/test_mediastore/test_server.py | 4 +- .../test_mediastoredata.py | 4 +- tests/test_mediastoredata/test_server.py | 4 +- tests/test_opsworks/test_apps.py | 3 +- tests/test_opsworks/test_instances.py | 3 +- tests/test_opsworks/test_layers.py | 3 +- tests/test_opsworks/test_stack.py | 3 +- .../organizations_test_utils.py | 2 - .../test_organizations_boto3.py | 106 +++++------ tests/test_packages/__init__.py | 2 - tests/test_packages/test_httpretty.py | 2 - tests/test_polly/test_polly.py | 5 +- tests/test_polly/test_server.py | 4 +- tests/test_ram/test_ram.py | 2 +- tests/test_rds/test_rds.py | 4 +- tests/test_rds/test_server.py | 4 +- tests/test_rds2/test_filters.py | 4 +- tests/test_rds2/test_rds2.py | 24 ++- tests/test_rds2/test_rds2_cloudformation.py | 2 +- tests/test_rds2/test_rds2_clusters.py | 2 +- tests/test_rds2/test_server.py | 7 +- tests/test_rds2/test_utils.py | 2 - tests/test_redshift/test_redshift.py | 4 +- .../test_redshift_cloudformation.py | 2 +- tests/test_redshift/test_server.py | 4 +- .../test_resourcegroups.py | 6 +- .../test_resourcegroupstaggingapi.py | 4 +- .../test_server.py | 4 +- tests/test_route53/test_route53.py | 6 +- tests/test_route53/test_route53_boto3.py | 2 +- .../test_route53_cloudformation.py | 2 +- tests/test_s3/test_s3.py | 38 ++-- tests/test_s3/test_s3_acl.py | 2 +- tests/test_s3/test_s3_auth.py | 2 +- tests/test_s3/test_s3_cloudformation.py | 12 +- tests/test_s3/test_s3_lifecycle.py | 4 +- tests/test_s3/test_s3_lock.py | 4 +- tests/test_s3/test_s3_metadata.py | 2 +- tests/test_s3/test_s3_multipart.py | 2 +- tests/test_s3/test_s3_replication.py | 2 +- tests/test_s3/test_s3_storageclass.py | 4 +- tests/test_s3/test_s3_utils.py | 1 - tests/test_s3/test_server.py | 5 +- .../test_s3bucket_path/test_s3bucket_path.py | 3 +- .../test_s3bucket_path_combo.py | 2 - .../test_s3bucket_path_utils.py | 1 - tests/test_s3bucket_path/test_server.py | 3 +- .../test_sagemaker_cloudformation.py | 2 +- .../test_sagemaker/test_sagemaker_endpoint.py | 5 +- tests/test_sagemaker/test_sagemaker_models.py | 5 +- .../test_sagemaker_notebooks.py | 5 +- .../test_sagemaker/test_sagemaker_training.py | 12 +- .../test_secretsmanager/test_list_secrets.py | 4 +- .../test_secretsmanager.py | 83 ++++----- tests/test_secretsmanager/test_server.py | 32 ++-- tests/test_ses/test_server.py | 3 +- tests/test_ses/test_ses.py | 3 +- tests/test_ses/test_ses_boto3.py | 4 +- tests/test_ses/test_ses_sns_boto3.py | 5 +- tests/test_sns/test_application.py | 4 +- tests/test_sns/test_application_boto3.py | 8 +- tests/test_sns/test_publishing.py | 5 +- tests/test_sns/test_publishing_boto3.py | 68 +++---- tests/test_sns/test_server.py | 3 +- tests/test_sns/test_sns_cloudformation.py | 2 +- tests/test_sns/test_subscriptions.py | 3 +- tests/test_sns/test_subscriptions_boto3.py | 3 +- tests/test_sns/test_topics.py | 3 +- tests/test_sns/test_topics_boto3.py | 3 +- tests/test_sqs/test_integration.py | 8 +- tests/test_sqs/test_server.py | 4 +- tests/test_sqs/test_sqs.py | 18 +- tests/test_sqs/test_sqs_cloudformation.py | 2 +- tests/test_ssm/test_ssm_boto3.py | 4 +- tests/test_ssm/test_ssm_cloudformation.py | 4 +- tests/test_ssm/test_ssm_docs.py | 4 +- .../test_stepfunctions/test_stepfunctions.py | 30 ++- .../test_stepfunctions_cloudformation.py | 4 +- tests/test_sts/test_server.py | 3 +- tests/test_sts/test_sts.py | 3 +- tests/test_support/test_server.py | 3 +- tests/test_support/test_support.py | 12 +- tests/test_swf/models/test_activity_task.py | 2 +- tests/test_swf/models/test_decision_task.py | 2 - tests/test_swf/models/test_domain.py | 2 +- tests/test_swf/models/test_generic_type.py | 2 +- tests/test_swf/models/test_history_event.py | 2 +- tests/test_swf/models/test_timeout.py | 2 +- .../models/test_workflow_execution.py | 2 +- .../test_swf/responses/test_activity_tasks.py | 2 +- .../test_swf/responses/test_activity_types.py | 2 +- .../test_swf/responses/test_decision_tasks.py | 2 +- tests/test_swf/responses/test_domains.py | 2 +- tests/test_swf/responses/test_timeouts.py | 2 +- .../responses/test_workflow_executions.py | 2 +- .../test_swf/responses/test_workflow_types.py | 2 +- tests/test_swf/test_exceptions.py | 3 +- tests/test_swf/test_utils.py | 2 +- .../test_transcribe/test_transcribe_boto3.py | 4 +- tests/test_wafv2/test_server.py | 9 +- tests/test_wafv2/test_utils.py | 3 - tests/test_wafv2/test_wafv2.py | 4 +- tests/test_xray/test_xray_boto3.py | 5 +- tests/test_xray/test_xray_client.py | 3 +- 725 files changed, 984 insertions(+), 2122 deletions(-) diff --git a/moto/__init__.py b/moto/__init__.py index 86fca6b99..2f10b25dc 100644 --- a/moto/__init__.py +++ b/moto/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import importlib diff --git a/moto/acm/__init__.py b/moto/acm/__init__.py index 07804282e..dc896d0ed 100644 --- a/moto/acm/__init__.py +++ b/moto/acm/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import acm_backends from ..core.models import base_decorator diff --git a/moto/acm/models.py b/moto/acm/models.py index 03143a950..7401aede3 100644 --- a/moto/acm/models.py +++ b/moto/acm/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import re import datetime diff --git a/moto/acm/responses.py b/moto/acm/responses.py index 581baaf70..9f73266be 100644 --- a/moto/acm/responses.py +++ b/moto/acm/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import base64 diff --git a/moto/acm/urls.py b/moto/acm/urls.py index c8a8b1bd1..0c3d4c588 100644 --- a/moto/acm/urls.py +++ b/moto/acm/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import AWSCertificateManagerResponse url_bases = [r"https?://acm\.(.+)\.amazonaws\.com"] diff --git a/moto/apigateway/__init__.py b/moto/apigateway/__init__.py index 42da3db53..785e7f2cd 100644 --- a/moto/apigateway/__init__.py +++ b/moto/apigateway/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import apigateway_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/apigateway/exceptions.py b/moto/apigateway/exceptions.py index fc6da5f1f..628166198 100644 --- a/moto/apigateway/exceptions.py +++ b/moto/apigateway/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/apigateway/models.py b/moto/apigateway/models.py index a48ee3f7d..d99710ef3 100644 --- a/moto/apigateway/models.py +++ b/moto/apigateway/models.py @@ -1,5 +1,4 @@ from __future__ import absolute_import -from __future__ import unicode_literals import random import string diff --git a/moto/apigateway/responses.py b/moto/apigateway/responses.py index d930ef3d2..f619b3b29 100644 --- a/moto/apigateway/responses.py +++ b/moto/apigateway/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.utilities.utils import merge_multiple_dicts diff --git a/moto/apigateway/urls.py b/moto/apigateway/urls.py index 2a2c15f13..2e500d665 100644 --- a/moto/apigateway/urls.py +++ b/moto/apigateway/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import APIGatewayResponse response = APIGatewayResponse() diff --git a/moto/apigateway/utils.py b/moto/apigateway/utils.py index acd492525..083b530b0 100644 --- a/moto/apigateway/utils.py +++ b/moto/apigateway/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string diff --git a/moto/applicationautoscaling/__init__.py b/moto/applicationautoscaling/__init__.py index 6e3db1ccf..2e173d23a 100644 --- a/moto/applicationautoscaling/__init__.py +++ b/moto/applicationautoscaling/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import applicationautoscaling_backends from ..core.models import base_decorator diff --git a/moto/applicationautoscaling/exceptions.py b/moto/applicationautoscaling/exceptions.py index e409da4e7..e7850d5e6 100644 --- a/moto/applicationautoscaling/exceptions.py +++ b/moto/applicationautoscaling/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/applicationautoscaling/models.py b/moto/applicationautoscaling/models.py index 637de8108..1153619c0 100644 --- a/moto/applicationautoscaling/models.py +++ b/moto/applicationautoscaling/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core import BaseBackend, BaseModel from moto.ecs import ecs_backends from .exceptions import AWSValidationException diff --git a/moto/applicationautoscaling/responses.py b/moto/applicationautoscaling/responses.py index c994fe12f..4e43a2a60 100644 --- a/moto/applicationautoscaling/responses.py +++ b/moto/applicationautoscaling/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse import json from .models import ( diff --git a/moto/applicationautoscaling/urls.py b/moto/applicationautoscaling/urls.py index fa82c64cf..632a0cd71 100644 --- a/moto/applicationautoscaling/urls.py +++ b/moto/applicationautoscaling/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ApplicationAutoScalingResponse url_bases = [r"https?://application-autoscaling\.(.+)\.amazonaws.com"] diff --git a/moto/athena/__init__.py b/moto/athena/__init__.py index 3c1dc15c5..6252967ec 100644 --- a/moto/athena/__init__.py +++ b/moto/athena/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import athena_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/athena/exceptions.py b/moto/athena/exceptions.py index 96b35556a..50a01d25d 100644 --- a/moto/athena/exceptions.py +++ b/moto/athena/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest diff --git a/moto/athena/models.py b/moto/athena/models.py index 64587729d..defa6c356 100644 --- a/moto/athena/models.py +++ b/moto/athena/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import time from boto3 import Session diff --git a/moto/athena/urls.py b/moto/athena/urls.py index 80540c7bb..6c5d7c712 100644 --- a/moto/athena/urls.py +++ b/moto/athena/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import AthenaResponse url_bases = [r"https?://athena\.(.+)\.amazonaws\.com"] diff --git a/moto/athena/utils.py b/moto/athena/utils.py index baffc4882..e69de29bb 100644 --- a/moto/athena/utils.py +++ b/moto/athena/utils.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/moto/autoscaling/__init__.py b/moto/autoscaling/__init__.py index 13c1adb16..151c89ea9 100644 --- a/moto/autoscaling/__init__.py +++ b/moto/autoscaling/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import autoscaling_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/autoscaling/exceptions.py b/moto/autoscaling/exceptions.py index 2fddd18ec..ced239919 100644 --- a/moto/autoscaling/exceptions.py +++ b/moto/autoscaling/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/autoscaling/models.py b/moto/autoscaling/models.py index f416a5621..079b6bcbf 100644 --- a/moto/autoscaling/models.py +++ b/moto/autoscaling/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import random from moto.packages.boto.ec2.blockdevicemapping import ( diff --git a/moto/autoscaling/responses.py b/moto/autoscaling/responses.py index 52b40dd0a..2e5f1f462 100644 --- a/moto/autoscaling/responses.py +++ b/moto/autoscaling/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import datetime from moto.core.responses import BaseResponse diff --git a/moto/autoscaling/urls.py b/moto/autoscaling/urls.py index 1a8750ecf..befd33b0d 100644 --- a/moto/autoscaling/urls.py +++ b/moto/autoscaling/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import AutoScalingResponse url_bases = [r"https?://autoscaling\.(.+)\.amazonaws\.com"] diff --git a/moto/awslambda/__init__.py b/moto/awslambda/__init__.py index d40bf051a..e8b1e49f9 100644 --- a/moto/awslambda/__init__.py +++ b/moto/awslambda/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import lambda_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/awslambda/models.py b/moto/awslambda/models.py index 2dd094fae..fd8aabe17 100644 --- a/moto/awslambda/models.py +++ b/moto/awslambda/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import time from collections import defaultdict diff --git a/moto/awslambda/policy.py b/moto/awslambda/policy.py index 35c084f80..1f16b865d 100644 --- a/moto/awslambda/policy.py +++ b/moto/awslambda/policy.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json import uuid diff --git a/moto/awslambda/responses.py b/moto/awslambda/responses.py index c78c85238..a0be74764 100644 --- a/moto/awslambda/responses.py +++ b/moto/awslambda/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json try: diff --git a/moto/awslambda/urls.py b/moto/awslambda/urls.py index 328e92bfd..c58c6ed8c 100644 --- a/moto/awslambda/urls.py +++ b/moto/awslambda/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import LambdaResponse url_bases = [r"https?://lambda\.(.+)\.amazonaws\.com"] diff --git a/moto/backends.py b/moto/backends.py index 74f8dcea2..67af7f480 100644 --- a/moto/backends.py +++ b/moto/backends.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import importlib import moto import sys diff --git a/moto/batch/__init__.py b/moto/batch/__init__.py index 40144d35d..753e77002 100644 --- a/moto/batch/__init__.py +++ b/moto/batch/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import batch_backends from ..core.models import base_decorator diff --git a/moto/batch/exceptions.py b/moto/batch/exceptions.py index 5d3ea3fd0..b5b8b324c 100644 --- a/moto/batch/exceptions.py +++ b/moto/batch/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import AWSError diff --git a/moto/batch/models.py b/moto/batch/models.py index e1cbac13d..5b901da1f 100644 --- a/moto/batch/models.py +++ b/moto/batch/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import re from itertools import cycle import datetime diff --git a/moto/batch/responses.py b/moto/batch/responses.py index cbe48d6c9..62ca04a44 100644 --- a/moto/batch/responses.py +++ b/moto/batch/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import batch_backends from urllib.parse import urlsplit diff --git a/moto/batch/urls.py b/moto/batch/urls.py index d8df974c1..fee031e5a 100644 --- a/moto/batch/urls.py +++ b/moto/batch/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import BatchResponse url_bases = [r"https?://batch\.(.+)\.amazonaws.com"] diff --git a/moto/batch/utils.py b/moto/batch/utils.py index d9f79e236..820e3d0d8 100644 --- a/moto/batch/utils.py +++ b/moto/batch/utils.py @@ -1,6 +1,3 @@ -from __future__ import unicode_literals - - def make_arn_for_compute_env(account_id, name, region_name): return "arn:aws:batch:{0}:{1}:compute-environment/{2}".format( region_name, account_id, name diff --git a/moto/cloudformation/__init__.py b/moto/cloudformation/__init__.py index 351af146c..b1e0571b2 100644 --- a/moto/cloudformation/__init__.py +++ b/moto/cloudformation/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import cloudformation_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/cloudformation/exceptions.py b/moto/cloudformation/exceptions.py index 83faec78e..51fdea280 100644 --- a/moto/cloudformation/exceptions.py +++ b/moto/cloudformation/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from werkzeug.exceptions import BadRequest from jinja2 import Template diff --git a/moto/cloudformation/models.py b/moto/cloudformation/models.py index 2ca7ee339..69ddb168a 100644 --- a/moto/cloudformation/models.py +++ b/moto/cloudformation/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from datetime import datetime, timedelta import json import yaml diff --git a/moto/cloudformation/parsing.py b/moto/cloudformation/parsing.py index ac1c37f39..b38f5f377 100644 --- a/moto/cloudformation/parsing.py +++ b/moto/cloudformation/parsing.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import functools import json import logging diff --git a/moto/cloudformation/responses.py b/moto/cloudformation/responses.py index f9b7d16bf..2c56ef9e8 100644 --- a/moto/cloudformation/responses.py +++ b/moto/cloudformation/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json import yaml from urllib.parse import urlparse diff --git a/moto/cloudformation/urls.py b/moto/cloudformation/urls.py index 63ed9ddb1..e8e77e8cf 100644 --- a/moto/cloudformation/urls.py +++ b/moto/cloudformation/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import CloudFormationResponse url_bases = [r"https?://cloudformation\.(.+)\.amazonaws\.com"] diff --git a/moto/cloudformation/utils.py b/moto/cloudformation/utils.py index 201d7757b..652c6952b 100644 --- a/moto/cloudformation/utils.py +++ b/moto/cloudformation/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import uuid import random import yaml diff --git a/moto/cloudwatch/utils.py b/moto/cloudwatch/utils.py index 896133d04..da9d93ac0 100644 --- a/moto/cloudwatch/utils.py +++ b/moto/cloudwatch/utils.py @@ -1,6 +1,3 @@ -from __future__ import unicode_literals - - def make_arn_for_dashboard(account_id, name): return "arn:aws:cloudwatch::{0}dashboard/{1}".format(account_id, name) diff --git a/moto/codecommit/urls.py b/moto/codecommit/urls.py index 1d3acaa7a..433d7da9f 100644 --- a/moto/codecommit/urls.py +++ b/moto/codecommit/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import CodeCommitResponse url_bases = [r"https?://codecommit\.(.+)\.amazonaws\.com"] diff --git a/moto/codepipeline/urls.py b/moto/codepipeline/urls.py index 5c57d9885..610aa59ed 100644 --- a/moto/codepipeline/urls.py +++ b/moto/codepipeline/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import CodePipelineResponse url_bases = [r"https?://codepipeline\.(.+)\.amazonaws\.com"] diff --git a/moto/cognitoidentity/__init__.py b/moto/cognitoidentity/__init__.py index 8045b9d0f..15137411b 100644 --- a/moto/cognitoidentity/__init__.py +++ b/moto/cognitoidentity/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import cognitoidentity_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/cognitoidentity/exceptions.py b/moto/cognitoidentity/exceptions.py index b3e811aee..947ae8047 100644 --- a/moto/cognitoidentity/exceptions.py +++ b/moto/cognitoidentity/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest diff --git a/moto/cognitoidentity/models.py b/moto/cognitoidentity/models.py index 94827a959..291133381 100644 --- a/moto/cognitoidentity/models.py +++ b/moto/cognitoidentity/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import json import re diff --git a/moto/cognitoidentity/responses.py b/moto/cognitoidentity/responses.py index 7571027c7..1910b6133 100644 --- a/moto/cognitoidentity/responses.py +++ b/moto/cognitoidentity/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from .models import cognitoidentity_backends from .utils import get_random_identity_id diff --git a/moto/cognitoidentity/urls.py b/moto/cognitoidentity/urls.py index c612644ed..dd833cdd4 100644 --- a/moto/cognitoidentity/urls.py +++ b/moto/cognitoidentity/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import CognitoIdentityResponse url_bases = [r"https?://cognito-identity\.(.+)\.amazonaws.com"] diff --git a/moto/cognitoidp/__init__.py b/moto/cognitoidp/__init__.py index 676e2dd77..5fa400112 100644 --- a/moto/cognitoidp/__init__.py +++ b/moto/cognitoidp/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import cognitoidp_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/cognitoidp/exceptions.py b/moto/cognitoidp/exceptions.py index baf5f6526..d6ecf462a 100644 --- a/moto/cognitoidp/exceptions.py +++ b/moto/cognitoidp/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest from moto.core.exceptions import JsonRESTError diff --git a/moto/cognitoidp/models.py b/moto/cognitoidp/models.py index 9f69ba56f..a00c7bdb5 100644 --- a/moto/cognitoidp/models.py +++ b/moto/cognitoidp/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import hashlib import json diff --git a/moto/cognitoidp/responses.py b/moto/cognitoidp/responses.py index 282de42eb..9b976caf2 100644 --- a/moto/cognitoidp/responses.py +++ b/moto/cognitoidp/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json import os import re diff --git a/moto/cognitoidp/urls.py b/moto/cognitoidp/urls.py index a2185899c..7df8f3e6e 100644 --- a/moto/cognitoidp/urls.py +++ b/moto/cognitoidp/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import CognitoIdpResponse, CognitoIdpJsonWebKeyResponse url_bases = [r"https?://cognito-idp\.(.+)\.amazonaws.com"] diff --git a/moto/cognitoidp/utils.py b/moto/cognitoidp/utils.py index ff7f91e18..504dfbe5d 100644 --- a/moto/cognitoidp/utils.py +++ b/moto/cognitoidp/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string import hashlib diff --git a/moto/config/urls.py b/moto/config/urls.py index a7c4b01e2..ed6c8b99b 100644 --- a/moto/config/urls.py +++ b/moto/config/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ConfigResponse url_bases = [r"https?://config\.(.+)\.amazonaws\.com"] diff --git a/moto/core/__init__.py b/moto/core/__init__.py index 09f5b1e16..3511ca9d3 100644 --- a/moto/core/__init__.py +++ b/moto/core/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .models import BaseModel, BaseBackend, moto_api_backend, ACCOUNT_ID # noqa from .models import CloudFormationModel # noqa from .responses import ActionAuthenticatorMixin diff --git a/moto/core/exceptions.py b/moto/core/exceptions.py index 076915551..d7b593283 100644 --- a/moto/core/exceptions.py +++ b/moto/core/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from werkzeug.exceptions import HTTPException from jinja2 import DictLoader, Environment import json diff --git a/moto/core/models.py b/moto/core/models.py index 0a5338138..360a819c2 100644 --- a/moto/core/models.py +++ b/moto/core/models.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import functools import inspect import os diff --git a/moto/core/responses.py b/moto/core/responses.py index e016b1bfb..93aa0fee8 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import functools from collections import defaultdict import datetime diff --git a/moto/core/urls.py b/moto/core/urls.py index 12036b5c3..60cd691f8 100644 --- a/moto/core/urls.py +++ b/moto/core/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import MotoAPIResponse url_bases = ["https?://motoapi.amazonaws.com"] diff --git a/moto/core/utils.py b/moto/core/utils.py index a8d7aa44f..519fabd35 100644 --- a/moto/core/utils.py +++ b/moto/core/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from functools import wraps import binascii @@ -317,30 +316,6 @@ def path_url(url): return path -def py2_strip_unicode_keys(blob): - """For Python 2 Only -- this will convert unicode keys in nested Dicts, Lists, and Sets to standard strings.""" - if type(blob) == unicode: # noqa - return str(blob) - - elif type(blob) == dict: - for key in list(blob.keys()): - value = blob.pop(key) - blob[str(key)] = py2_strip_unicode_keys(value) - - elif type(blob) == list: - for i in range(0, len(blob)): - blob[i] = py2_strip_unicode_keys(blob[i]) - - elif type(blob) == set: - new_set = set() - for value in blob: - new_set.add(py2_strip_unicode_keys(value)) - - blob = new_set - - return blob - - def tags_from_query_string( querystring_dict, prefix="Tag", key_suffix="Key", value_suffix="Value" ): diff --git a/moto/datapipeline/__init__.py b/moto/datapipeline/__init__.py index 42ee5d6ff..255ce0df8 100644 --- a/moto/datapipeline/__init__.py +++ b/moto/datapipeline/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import datapipeline_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/datapipeline/models.py b/moto/datapipeline/models.py index ed1996329..aed37ad9d 100644 --- a/moto/datapipeline/models.py +++ b/moto/datapipeline/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime from boto3 import Session diff --git a/moto/datapipeline/responses.py b/moto/datapipeline/responses.py index 42e1ff2c3..cba52609b 100644 --- a/moto/datapipeline/responses.py +++ b/moto/datapipeline/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/datapipeline/urls.py b/moto/datapipeline/urls.py index ae6d3c468..c77769705 100644 --- a/moto/datapipeline/urls.py +++ b/moto/datapipeline/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import DataPipelineResponse url_bases = [r"https?://datapipeline\.(.+)\.amazonaws\.com"] diff --git a/moto/datasync/__init__.py b/moto/datasync/__init__.py index 85134e4f1..c4c821429 100644 --- a/moto/datasync/__init__.py +++ b/moto/datasync/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from ..core.models import base_decorator, deprecated_base_decorator from .models import datasync_backends diff --git a/moto/datasync/exceptions.py b/moto/datasync/exceptions.py index b0f2d8f0f..06870ff2f 100644 --- a/moto/datasync/exceptions.py +++ b/moto/datasync/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import JsonRESTError diff --git a/moto/datasync/urls.py b/moto/datasync/urls.py index 66fbb2bc0..be1d6a1dd 100644 --- a/moto/datasync/urls.py +++ b/moto/datasync/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import DataSyncResponse url_bases = [r"https?://(.*\.)?(datasync)\.(.+)\.amazonaws.com"] diff --git a/moto/dms/__init__.py b/moto/dms/__init__.py index 7af2baf89..af997e2c1 100644 --- a/moto/dms/__init__.py +++ b/moto/dms/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import dms_backends from ..core.models import base_decorator diff --git a/moto/dms/exceptions.py b/moto/dms/exceptions.py index 6ae7a088b..0d46350d3 100644 --- a/moto/dms/exceptions.py +++ b/moto/dms/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/dms/models.py b/moto/dms/models.py index 063c6590d..e42ad6caf 100644 --- a/moto/dms/models.py +++ b/moto/dms/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from boto3 import Session diff --git a/moto/dms/responses.py b/moto/dms/responses.py index d94e43b87..2b533f6f7 100644 --- a/moto/dms/responses.py +++ b/moto/dms/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import dms_backends import json diff --git a/moto/dms/urls.py b/moto/dms/urls.py index ef1ce0fc9..c340c449a 100644 --- a/moto/dms/urls.py +++ b/moto/dms/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import DatabaseMigrationServiceResponse url_bases = [r"https?://dms\.(.+)\.amazonaws\.com"] diff --git a/moto/dms/utils.py b/moto/dms/utils.py index 9272e5306..cff278e12 100644 --- a/moto/dms/utils.py +++ b/moto/dms/utils.py @@ -1,6 +1,3 @@ -from __future__ import unicode_literals - - def match_task_arn(task, arns): return task["ReplicationTaskArn"] in arns diff --git a/moto/dynamodb/__init__.py b/moto/dynamodb/__init__.py index 4c2bc04d9..b58e70dbc 100644 --- a/moto/dynamodb/__init__.py +++ b/moto/dynamodb/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import dynamodb_backend dynamodb_backends = {"global": dynamodb_backend} diff --git a/moto/dynamodb/comparisons.py b/moto/dynamodb/comparisons.py index 5418f906f..f31b9d5c3 100644 --- a/moto/dynamodb/comparisons.py +++ b/moto/dynamodb/comparisons.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - # TODO add tests for all of these COMPARISON_FUNCS = { "EQ": lambda item_value, test_value: item_value == test_value, diff --git a/moto/dynamodb/models.py b/moto/dynamodb/models.py index beb4d002c..9e0bb282d 100644 --- a/moto/dynamodb/models.py +++ b/moto/dynamodb/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from collections import defaultdict import datetime import json diff --git a/moto/dynamodb/responses.py b/moto/dynamodb/responses.py index f9c38408b..bcd9d1b30 100644 --- a/moto/dynamodb/responses.py +++ b/moto/dynamodb/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from moto.core.responses import BaseResponse diff --git a/moto/dynamodb/urls.py b/moto/dynamodb/urls.py index af5a74830..59f70de77 100644 --- a/moto/dynamodb/urls.py +++ b/moto/dynamodb/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import DynamoHandler url_bases = [r"https?://dynamodb\.(.+)\.amazonaws\.com"] diff --git a/moto/dynamodb2/__init__.py b/moto/dynamodb2/__init__.py index d141511c8..476f04fdf 100644 --- a/moto/dynamodb2/__init__.py +++ b/moto/dynamodb2/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.dynamodb2.models import dynamodb_backends as dynamodb_backends2 from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/dynamodb2/comparisons.py b/moto/dynamodb2/comparisons.py index d17ae6875..260ae6857 100644 --- a/moto/dynamodb2/comparisons.py +++ b/moto/dynamodb2/comparisons.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import re from collections import deque from collections import namedtuple diff --git a/moto/dynamodb2/models/__init__.py b/moto/dynamodb2/models/__init__.py index 3bd248953..88b00eaf1 100644 --- a/moto/dynamodb2/models/__init__.py +++ b/moto/dynamodb2/models/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from collections import defaultdict import copy import datetime diff --git a/moto/dynamodb2/responses.py b/moto/dynamodb2/responses.py index 75e49c3ca..01915495d 100644 --- a/moto/dynamodb2/responses.py +++ b/moto/dynamodb2/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import copy import json import re diff --git a/moto/dynamodb2/urls.py b/moto/dynamodb2/urls.py index af5a74830..59f70de77 100644 --- a/moto/dynamodb2/urls.py +++ b/moto/dynamodb2/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import DynamoHandler url_bases = [r"https?://dynamodb\.(.+)\.amazonaws\.com"] diff --git a/moto/dynamodbstreams/__init__.py b/moto/dynamodbstreams/__init__.py index 85dd5404c..307df29cd 100644 --- a/moto/dynamodbstreams/__init__.py +++ b/moto/dynamodbstreams/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import dynamodbstreams_backends from ..core.models import base_decorator diff --git a/moto/dynamodbstreams/models.py b/moto/dynamodbstreams/models.py index f62c49877..992a2b586 100644 --- a/moto/dynamodbstreams/models.py +++ b/moto/dynamodbstreams/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import os import json import base64 diff --git a/moto/dynamodbstreams/responses.py b/moto/dynamodbstreams/responses.py index 001d989a6..b0707ff44 100644 --- a/moto/dynamodbstreams/responses.py +++ b/moto/dynamodbstreams/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from .models import dynamodbstreams_backends diff --git a/moto/dynamodbstreams/urls.py b/moto/dynamodbstreams/urls.py index 83fd48db0..70cbcc189 100644 --- a/moto/dynamodbstreams/urls.py +++ b/moto/dynamodbstreams/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import DynamoDBStreamsHandler url_bases = [r"https?://streams\.dynamodb\.(.+)\.amazonaws.com"] diff --git a/moto/ec2/__init__.py b/moto/ec2/__init__.py index c16912f57..1a59762e7 100644 --- a/moto/ec2/__init__.py +++ b/moto/ec2/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import ec2_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/ec2/exceptions.py b/moto/ec2/exceptions.py index a5cacdb23..9b8f595f8 100644 --- a/moto/ec2/exceptions.py +++ b/moto/ec2/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 35c6f4362..901014b4d 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import copy from datetime import datetime import itertools diff --git a/moto/ec2/responses/__init__.py b/moto/ec2/responses/__init__.py index 008b81f2a..4d3a39751 100644 --- a/moto/ec2/responses/__init__.py +++ b/moto/ec2/responses/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .account_attributes import AccountAttributes from .amazon_dev_pay import AmazonDevPay from .amis import AmisResponse diff --git a/moto/ec2/responses/account_attributes.py b/moto/ec2/responses/account_attributes.py index 068a7c395..5ecc8ab5f 100644 --- a/moto/ec2/responses/account_attributes.py +++ b/moto/ec2/responses/account_attributes.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/amazon_dev_pay.py b/moto/ec2/responses/amazon_dev_pay.py index 982b7f4a3..c5a188a35 100644 --- a/moto/ec2/responses/amazon_dev_pay.py +++ b/moto/ec2/responses/amazon_dev_pay.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/amis.py b/moto/ec2/responses/amis.py index f22ad2ccf..28c02ec8c 100644 --- a/moto/ec2/responses/amis.py +++ b/moto/ec2/responses/amis.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/availability_zones_and_regions.py b/moto/ec2/responses/availability_zones_and_regions.py index b276d30bc..3345dea62 100644 --- a/moto/ec2/responses/availability_zones_and_regions.py +++ b/moto/ec2/responses/availability_zones_and_regions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/customer_gateways.py b/moto/ec2/responses/customer_gateways.py index e5a6e6313..3b665b3c7 100644 --- a/moto/ec2/responses/customer_gateways.py +++ b/moto/ec2/responses/customer_gateways.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/dhcp_options.py b/moto/ec2/responses/dhcp_options.py index 6eae4e3e8..58bb987c6 100644 --- a/moto/ec2/responses/dhcp_options.py +++ b/moto/ec2/responses/dhcp_options.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring, dhcp_configuration_from_querystring diff --git a/moto/ec2/responses/elastic_block_store.py b/moto/ec2/responses/elastic_block_store.py index c38c1e233..56b10048f 100644 --- a/moto/ec2/responses/elastic_block_store.py +++ b/moto/ec2/responses/elastic_block_store.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/elastic_ip_addresses.py b/moto/ec2/responses/elastic_ip_addresses.py index 223854ca6..99362670a 100644 --- a/moto/ec2/responses/elastic_ip_addresses.py +++ b/moto/ec2/responses/elastic_ip_addresses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring, add_tag_specification diff --git a/moto/ec2/responses/elastic_network_interfaces.py b/moto/ec2/responses/elastic_network_interfaces.py index 409951f98..0f1c61aa1 100644 --- a/moto/ec2/responses/elastic_network_interfaces.py +++ b/moto/ec2/responses/elastic_network_interfaces.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring, add_tag_specification diff --git a/moto/ec2/responses/flow_logs.py b/moto/ec2/responses/flow_logs.py index 74930f291..dd416df05 100644 --- a/moto/ec2/responses/flow_logs.py +++ b/moto/ec2/responses/flow_logs.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.models import validate_resource_ids from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/general.py b/moto/ec2/responses/general.py index 5dcd73358..d452a0989 100644 --- a/moto/ec2/responses/general.py +++ b/moto/ec2/responses/general.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/iam_instance_profiles.py b/moto/ec2/responses/iam_instance_profiles.py index 3d2525ba7..0d4f2f50c 100644 --- a/moto/ec2/responses/iam_instance_profiles.py +++ b/moto/ec2/responses/iam_instance_profiles.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py index 319cad959..2742a28bc 100644 --- a/moto/ec2/responses/instances.py +++ b/moto/ec2/responses/instances.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.autoscaling import autoscaling_backends from moto.core.responses import BaseResponse from moto.core.utils import camelcase_to_underscores diff --git a/moto/ec2/responses/internet_gateways.py b/moto/ec2/responses/internet_gateways.py index 732faa7c0..133896d78 100644 --- a/moto/ec2/responses/internet_gateways.py +++ b/moto/ec2/responses/internet_gateways.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/ip_addresses.py b/moto/ec2/responses/ip_addresses.py index 789abfdec..258b332d7 100644 --- a/moto/ec2/responses/ip_addresses.py +++ b/moto/ec2/responses/ip_addresses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/key_pairs.py b/moto/ec2/responses/key_pairs.py index 1faa3d811..730c679ff 100644 --- a/moto/ec2/responses/key_pairs.py +++ b/moto/ec2/responses/key_pairs.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/monitoring.py b/moto/ec2/responses/monitoring.py index 4ef8db087..ce8fc7630 100644 --- a/moto/ec2/responses/monitoring.py +++ b/moto/ec2/responses/monitoring.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/nat_gateways.py b/moto/ec2/responses/nat_gateways.py index 8654253dc..a5938e96e 100644 --- a/moto/ec2/responses/nat_gateways.py +++ b/moto/ec2/responses/nat_gateways.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring, add_tag_specification diff --git a/moto/ec2/responses/network_acls.py b/moto/ec2/responses/network_acls.py index 136808375..12383c8bb 100644 --- a/moto/ec2/responses/network_acls.py +++ b/moto/ec2/responses/network_acls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/placement_groups.py b/moto/ec2/responses/placement_groups.py index 2a7ade653..f7e6bb540 100644 --- a/moto/ec2/responses/placement_groups.py +++ b/moto/ec2/responses/placement_groups.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/reserved_instances.py b/moto/ec2/responses/reserved_instances.py index 23a2b8715..78b4d7f2c 100644 --- a/moto/ec2/responses/reserved_instances.py +++ b/moto/ec2/responses/reserved_instances.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/route_tables.py b/moto/ec2/responses/route_tables.py index 4a10657a3..d969738a2 100644 --- a/moto/ec2/responses/route_tables.py +++ b/moto/ec2/responses/route_tables.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/security_groups.py b/moto/ec2/responses/security_groups.py index aafae8c52..8f8e1ad94 100644 --- a/moto/ec2/responses/security_groups.py +++ b/moto/ec2/responses/security_groups.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/spot_fleets.py b/moto/ec2/responses/spot_fleets.py index b7de85323..8b0b3e20f 100644 --- a/moto/ec2/responses/spot_fleets.py +++ b/moto/ec2/responses/spot_fleets.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/spot_instances.py b/moto/ec2/responses/spot_instances.py index 59f4da327..5b16a29c5 100644 --- a/moto/ec2/responses/spot_instances.py +++ b/moto/ec2/responses/spot_instances.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/subnets.py b/moto/ec2/responses/subnets.py index ad3a5f56a..e711014f5 100644 --- a/moto/ec2/responses/subnets.py +++ b/moto/ec2/responses/subnets.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random from moto.core.responses import BaseResponse from moto.core.utils import camelcase_to_underscores diff --git a/moto/ec2/responses/tags.py b/moto/ec2/responses/tags.py index 0c7d89a41..88371fede 100644 --- a/moto/ec2/responses/tags.py +++ b/moto/ec2/responses/tags.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from moto.ec2.models import validate_resource_ids from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/transit_gateway_attachments.py b/moto/ec2/responses/transit_gateway_attachments.py index 5d6b201fd..6efdd8b2a 100644 --- a/moto/ec2/responses/transit_gateway_attachments.py +++ b/moto/ec2/responses/transit_gateway_attachments.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring, add_tag_specification diff --git a/moto/ec2/responses/transit_gateway_route_tables.py b/moto/ec2/responses/transit_gateway_route_tables.py index da760f335..064e84107 100644 --- a/moto/ec2/responses/transit_gateway_route_tables.py +++ b/moto/ec2/responses/transit_gateway_route_tables.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring from moto.utilities.utils import str2bool diff --git a/moto/ec2/responses/transit_gateways.py b/moto/ec2/responses/transit_gateways.py index c8b013b1f..8e326a001 100644 --- a/moto/ec2/responses/transit_gateways.py +++ b/moto/ec2/responses/transit_gateways.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/virtual_private_gateways.py b/moto/ec2/responses/virtual_private_gateways.py index 1ee56b27a..5616baf8e 100644 --- a/moto/ec2/responses/virtual_private_gateways.py +++ b/moto/ec2/responses/virtual_private_gateways.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring diff --git a/moto/ec2/responses/vm_export.py b/moto/ec2/responses/vm_export.py index a4c831fcb..8a3fa0d76 100644 --- a/moto/ec2/responses/vm_export.py +++ b/moto/ec2/responses/vm_export.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/vm_import.py b/moto/ec2/responses/vm_import.py index 50f77c66c..9f43de092 100644 --- a/moto/ec2/responses/vm_import.py +++ b/moto/ec2/responses/vm_import.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/responses/vpc_peering_connections.py b/moto/ec2/responses/vpc_peering_connections.py index 89d5035ce..9f90641e8 100644 --- a/moto/ec2/responses/vpc_peering_connections.py +++ b/moto/ec2/responses/vpc_peering_connections.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.core import ACCOUNT_ID diff --git a/moto/ec2/responses/vpcs.py b/moto/ec2/responses/vpcs.py index 230d23bea..6b10cd20b 100644 --- a/moto/ec2/responses/vpcs.py +++ b/moto/ec2/responses/vpcs.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core import ACCOUNT_ID from moto.core.responses import BaseResponse from moto.core.utils import camelcase_to_underscores diff --git a/moto/ec2/responses/vpn_connections.py b/moto/ec2/responses/vpn_connections.py index a5187de6a..4a8fa698d 100644 --- a/moto/ec2/responses/vpn_connections.py +++ b/moto/ec2/responses/vpn_connections.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from moto.ec2.utils import filters_from_querystring, add_tag_specification from xml.sax.saxutils import escape diff --git a/moto/ec2/responses/windows.py b/moto/ec2/responses/windows.py index 14b2b0666..673fc6ded 100644 --- a/moto/ec2/responses/windows.py +++ b/moto/ec2/responses/windows.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse diff --git a/moto/ec2/urls.py b/moto/ec2/urls.py index 78f234320..8ab8ead92 100644 --- a/moto/ec2/urls.py +++ b/moto/ec2/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import EC2Response diff --git a/moto/ec2/utils.py b/moto/ec2/utils.py index 37de6073a..32689dc05 100644 --- a/moto/ec2/utils.py +++ b/moto/ec2/utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import hashlib import fnmatch diff --git a/moto/ec2instanceconnect/urls.py b/moto/ec2instanceconnect/urls.py index d7b6b7ce4..acb8686db 100644 --- a/moto/ec2instanceconnect/urls.py +++ b/moto/ec2instanceconnect/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import Ec2InstanceConnectResponse url_bases = [r"https?://ec2-instance-connect\.(.+)\.amazonaws\.com"] diff --git a/moto/ecr/__init__.py b/moto/ecr/__init__.py index e90cd9e4c..a3a0bc6bd 100644 --- a/moto/ecr/__init__.py +++ b/moto/ecr/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import ecr_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/ecr/exceptions.py b/moto/ecr/exceptions.py index d83c396b3..a28fd8f4e 100644 --- a/moto/ecr/exceptions.py +++ b/moto/ecr/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/ecr/models.py b/moto/ecr/models.py index 2a0e87064..3409b8bf0 100644 --- a/moto/ecr/models.py +++ b/moto/ecr/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import hashlib import json import re diff --git a/moto/ecr/responses.py b/moto/ecr/responses.py index e3126a9ce..d62131f3f 100644 --- a/moto/ecr/responses.py +++ b/moto/ecr/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from base64 import b64encode from datetime import datetime diff --git a/moto/ecr/urls.py b/moto/ecr/urls.py index 9042338a6..2371ea010 100644 --- a/moto/ecr/urls.py +++ b/moto/ecr/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ECRResponse url_bases = [ diff --git a/moto/ecs/__init__.py b/moto/ecs/__init__.py index 3048838be..2258fe378 100644 --- a/moto/ecs/__init__.py +++ b/moto/ecs/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import ecs_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/ecs/exceptions.py b/moto/ecs/exceptions.py index d902bcc95..40bd036f9 100644 --- a/moto/ecs/exceptions.py +++ b/moto/ecs/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError, JsonRESTError diff --git a/moto/ecs/models.py b/moto/ecs/models.py index 704f7457f..3245ce03e 100644 --- a/moto/ecs/models.py +++ b/moto/ecs/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re import uuid from copy import copy diff --git a/moto/ecs/responses.py b/moto/ecs/responses.py index c80af7ee2..578a55538 100644 --- a/moto/ecs/responses.py +++ b/moto/ecs/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from moto.core.responses import BaseResponse diff --git a/moto/ecs/urls.py b/moto/ecs/urls.py index a8ed67dc8..d7b5bcb3d 100644 --- a/moto/ecs/urls.py +++ b/moto/ecs/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import EC2ContainerServiceResponse url_bases = [r"https?://ecs\.(.+)\.amazonaws\.com"] diff --git a/moto/efs/__init__.py b/moto/efs/__init__.py index b7aabdeba..e03e33d7f 100644 --- a/moto/efs/__init__.py +++ b/moto/efs/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from ..core.models import base_decorator from .models import efs_backends diff --git a/moto/efs/exceptions.py b/moto/efs/exceptions.py index dec1d9833..eed130909 100644 --- a/moto/efs/exceptions.py +++ b/moto/efs/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import RESTError diff --git a/moto/efs/models.py b/moto/efs/models.py index 32691d02b..e39085f01 100644 --- a/moto/efs/models.py +++ b/moto/efs/models.py @@ -4,8 +4,6 @@ See AWS docs for details: https://docs.aws.amazon.com/efs/latest/ug/whatisefs.html """ -from __future__ import unicode_literals - import json import time from copy import deepcopy diff --git a/moto/efs/responses.py b/moto/efs/responses.py index cfbeb00e4..c04102d30 100644 --- a/moto/efs/responses.py +++ b/moto/efs/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/efs/urls.py b/moto/efs/urls.py index 0470a1d85..052e1c942 100644 --- a/moto/efs/urls.py +++ b/moto/efs/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import EFSResponse url_bases = [ diff --git a/moto/eks/__init__.py b/moto/eks/__init__.py index 3a2a947f9..2cbbabf23 100644 --- a/moto/eks/__init__.py +++ b/moto/eks/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from ..core.models import base_decorator from .models import eks_backends diff --git a/moto/eks/exceptions.py b/moto/eks/exceptions.py index ae807ceb8..49a7a52e1 100644 --- a/moto/eks/exceptions.py +++ b/moto/eks/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.exceptions import AWSError diff --git a/moto/eks/models.py b/moto/eks/models.py index c411aed3f..62d9e88f3 100644 --- a/moto/eks/models.py +++ b/moto/eks/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from datetime import datetime from uuid import uuid4 diff --git a/moto/eks/responses.py b/moto/eks/responses.py index 231993b23..45d0c891c 100644 --- a/moto/eks/responses.py +++ b/moto/eks/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/eks/urls.py b/moto/eks/urls.py index 6ed6dfc39..f8355c7c3 100644 --- a/moto/eks/urls.py +++ b/moto/eks/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import EKSResponse url_bases = [ diff --git a/moto/elasticbeanstalk/urls.py b/moto/elasticbeanstalk/urls.py index 42f52fd29..91f0cc227 100644 --- a/moto/elasticbeanstalk/urls.py +++ b/moto/elasticbeanstalk/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import EBResponse url_bases = [ diff --git a/moto/elastictranscoder/__init__.py b/moto/elastictranscoder/__init__.py index 55776199d..d2a277102 100644 --- a/moto/elastictranscoder/__init__.py +++ b/moto/elastictranscoder/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import elastictranscoder_backends from ..core.models import base_decorator diff --git a/moto/elastictranscoder/models.py b/moto/elastictranscoder/models.py index 801fbd326..f43dca78b 100644 --- a/moto/elastictranscoder/models.py +++ b/moto/elastictranscoder/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from boto3 import Session from moto.core import ACCOUNT_ID, BaseBackend, BaseModel import random diff --git a/moto/elastictranscoder/responses.py b/moto/elastictranscoder/responses.py index 595e65e2b..3f5396e1b 100644 --- a/moto/elastictranscoder/responses.py +++ b/moto/elastictranscoder/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core import ACCOUNT_ID from moto.core.responses import BaseResponse from .models import elastictranscoder_backends diff --git a/moto/elastictranscoder/urls.py b/moto/elastictranscoder/urls.py index 746663b6e..e751dba4e 100644 --- a/moto/elastictranscoder/urls.py +++ b/moto/elastictranscoder/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ElasticTranscoderResponse url_bases = [ diff --git a/moto/elb/__init__.py b/moto/elb/__init__.py index d3627ed6d..b035a5e1d 100644 --- a/moto/elb/__init__.py +++ b/moto/elb/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import elb_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/elb/exceptions.py b/moto/elb/exceptions.py index 14405df2c..b16947378 100644 --- a/moto/elb/exceptions.py +++ b/moto/elb/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/elb/models.py b/moto/elb/models.py index 4b479dbe2..429cfd596 100644 --- a/moto/elb/models.py +++ b/moto/elb/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import pytz diff --git a/moto/elb/responses.py b/moto/elb/responses.py index 81910a84f..3d4649665 100644 --- a/moto/elb/responses.py +++ b/moto/elb/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.packages.boto.ec2.elb.attributes import ( ConnectionSettingAttribute, ConnectionDrainingAttribute, diff --git a/moto/elb/urls.py b/moto/elb/urls.py index 2cfb8a789..5495c62c7 100644 --- a/moto/elb/urls.py +++ b/moto/elb/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from urllib.parse import parse_qs from botocore.awsrequest import AWSPreparedRequest diff --git a/moto/elbv2/__init__.py b/moto/elbv2/__init__.py index 61c4a37ff..5217dd29f 100644 --- a/moto/elbv2/__init__.py +++ b/moto/elbv2/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import elbv2_backends from ..core.models import base_decorator diff --git a/moto/elbv2/exceptions.py b/moto/elbv2/exceptions.py index 5d59f81f3..9790b79e8 100644 --- a/moto/elbv2/exceptions.py +++ b/moto/elbv2/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/elbv2/models.py b/moto/elbv2/models.py index bdfc11fbd..af9010146 100644 --- a/moto/elbv2/models.py +++ b/moto/elbv2/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import re from jinja2 import Template diff --git a/moto/elbv2/responses.py b/moto/elbv2/responses.py index d62115bf6..9333dc075 100644 --- a/moto/elbv2/responses.py +++ b/moto/elbv2/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError from moto.core.utils import amzn_request_id from moto.core.responses import BaseResponse diff --git a/moto/elbv2/urls.py b/moto/elbv2/urls.py index ccae40cec..7617b941b 100644 --- a/moto/elbv2/urls.py +++ b/moto/elbv2/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from ..elb.urls import api_version_elb_backend url_bases = [r"https?://elasticloadbalancing\.(.+)\.amazonaws.com"] diff --git a/moto/emr/__init__.py b/moto/emr/__init__.py index d35506271..d8116fc14 100644 --- a/moto/emr/__init__.py +++ b/moto/emr/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import emr_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/emr/exceptions.py b/moto/emr/exceptions.py index 2cb779d2b..f8af97e81 100644 --- a/moto/emr/exceptions.py +++ b/moto/emr/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import RESTError, JsonRESTError diff --git a/moto/emr/models.py b/moto/emr/models.py index 39883467c..c67252152 100644 --- a/moto/emr/models.py +++ b/moto/emr/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from datetime import datetime from datetime import timedelta diff --git a/moto/emr/responses.py b/moto/emr/responses.py index 9a3505357..b41e476fd 100644 --- a/moto/emr/responses.py +++ b/moto/emr/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import re from datetime import datetime diff --git a/moto/emr/urls.py b/moto/emr/urls.py index 8193a2b53..fae124777 100644 --- a/moto/emr/urls.py +++ b/moto/emr/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ElasticMapReduceResponse url_bases = [ diff --git a/moto/emr/utils.py b/moto/emr/utils.py index e6d9ca7f8..46c78b787 100644 --- a/moto/emr/utils.py +++ b/moto/emr/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import copy import datetime import random diff --git a/moto/events/__init__.py b/moto/events/__init__.py index 8fd414325..ec0c24e4b 100644 --- a/moto/events/__init__.py +++ b/moto/events/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .models import events_backends from ..core.models import base_decorator diff --git a/moto/events/exceptions.py b/moto/events/exceptions.py index 0952edd52..360a7c85b 100644 --- a/moto/events/exceptions.py +++ b/moto/events/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/events/urls.py b/moto/events/urls.py index 385fe28f1..a16779314 100644 --- a/moto/events/urls.py +++ b/moto/events/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import EventsHandler url_bases = [r"https?://events\.(.+)\.amazonaws\.com"] diff --git a/moto/forecast/__init__.py b/moto/forecast/__init__.py index 75b23b94a..e8fb838b4 100644 --- a/moto/forecast/__init__.py +++ b/moto/forecast/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .models import forecast_backends from ..core.models import base_decorator diff --git a/moto/forecast/exceptions.py b/moto/forecast/exceptions.py index dbc6f6414..dd347495d 100644 --- a/moto/forecast/exceptions.py +++ b/moto/forecast/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import AWSError diff --git a/moto/forecast/responses.py b/moto/forecast/responses.py index 09d55b0d8..17d362025 100644 --- a/moto/forecast/responses.py +++ b/moto/forecast/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/forecast/urls.py b/moto/forecast/urls.py index f2535fc80..706094c43 100644 --- a/moto/forecast/urls.py +++ b/moto/forecast/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import ForecastResponse url_bases = [r"https?://forecast\.(.+)\.amazonaws\.com"] diff --git a/moto/glacier/__init__.py b/moto/glacier/__init__.py index 270d580f5..15f9e7448 100644 --- a/moto/glacier/__init__.py +++ b/moto/glacier/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import glacier_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/glacier/models.py b/moto/glacier/models.py index bac78606e..7ac7406a2 100644 --- a/moto/glacier/models.py +++ b/moto/glacier/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import hashlib import datetime diff --git a/moto/glacier/responses.py b/moto/glacier/responses.py index da41de228..2703638c5 100644 --- a/moto/glacier/responses.py +++ b/moto/glacier/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from urllib.parse import urlparse, parse_qs diff --git a/moto/glacier/urls.py b/moto/glacier/urls.py index 8f0e89d65..1c35c1140 100644 --- a/moto/glacier/urls.py +++ b/moto/glacier/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import GlacierResponse url_bases = [r"https?://glacier\.(.+)\.amazonaws.com"] diff --git a/moto/glue/__init__.py b/moto/glue/__init__.py index 6b1f13326..204b20892 100644 --- a/moto/glue/__init__.py +++ b/moto/glue/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import glue_backend glue_backends = {"global": glue_backend} diff --git a/moto/glue/exceptions.py b/moto/glue/exceptions.py index c45a8199d..a77b9b88e 100644 --- a/moto/glue/exceptions.py +++ b/moto/glue/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/glue/models.py b/moto/glue/models.py index 0c416653e..296d5029d 100644 --- a/moto/glue/models.py +++ b/moto/glue/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import time from datetime import datetime diff --git a/moto/glue/responses.py b/moto/glue/responses.py index c4fd8bba3..d110eacc1 100644 --- a/moto/glue/responses.py +++ b/moto/glue/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/glue/urls.py b/moto/glue/urls.py index dbb0c2102..8e038f963 100644 --- a/moto/glue/urls.py +++ b/moto/glue/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import GlueResponse url_bases = [r"https?://glue\.(.+)\.amazonaws\.com"] diff --git a/moto/glue/utils.py b/moto/glue/utils.py index baffc4882..e69de29bb 100644 --- a/moto/glue/utils.py +++ b/moto/glue/utils.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/moto/iam/__init__.py b/moto/iam/__init__.py index 1dda654ce..86e570143 100644 --- a/moto/iam/__init__.py +++ b/moto/iam/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import iam_backend iam_backends = {"global": iam_backend} diff --git a/moto/iam/exceptions.py b/moto/iam/exceptions.py index 590a0bb95..3677e62e0 100644 --- a/moto/iam/exceptions.py +++ b/moto/iam/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError XMLNS_IAM = "https://iam.amazonaws.com/doc/2010-05-08/" diff --git a/moto/iam/models.py b/moto/iam/models.py index d6fd69ed1..922179bf1 100644 --- a/moto/iam/models.py +++ b/moto/iam/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import base64 import hashlib import os diff --git a/moto/iam/responses.py b/moto/iam/responses.py index 88392b1a3..617d96dcf 100644 --- a/moto/iam/responses.py +++ b/moto/iam/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from .models import iam_backend, User diff --git a/moto/iam/urls.py b/moto/iam/urls.py index 504f3bdb0..f453edb26 100644 --- a/moto/iam/urls.py +++ b/moto/iam/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import IamResponse url_bases = [r"https?://iam\.(.*\.)?amazonaws\.com"] diff --git a/moto/iam/utils.py b/moto/iam/utils.py index b333a07bc..42ca109bf 100644 --- a/moto/iam/utils.py +++ b/moto/iam/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string diff --git a/moto/instance_metadata/__init__.py b/moto/instance_metadata/__init__.py index d1a674982..4f02388a4 100644 --- a/moto/instance_metadata/__init__.py +++ b/moto/instance_metadata/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import instance_metadata_backend instance_metadata_backends = {"global": instance_metadata_backend} diff --git a/moto/instance_metadata/responses.py b/moto/instance_metadata/responses.py index 9bdb66ce3..13b2a0c63 100644 --- a/moto/instance_metadata/responses.py +++ b/moto/instance_metadata/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import datetime import json from urllib.parse import urlparse diff --git a/moto/instance_metadata/urls.py b/moto/instance_metadata/urls.py index b77935473..f495db731 100644 --- a/moto/instance_metadata/urls.py +++ b/moto/instance_metadata/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import InstanceMetadataResponse url_bases = ["http://169.254.169.254"] diff --git a/moto/iot/__init__.py b/moto/iot/__init__.py index 97d36fbcc..a639ee290 100644 --- a/moto/iot/__init__.py +++ b/moto/iot/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import iot_backends from ..core.models import base_decorator diff --git a/moto/iot/exceptions.py b/moto/iot/exceptions.py index 46e6b93ee..cd8511b47 100644 --- a/moto/iot/exceptions.py +++ b/moto/iot/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/iot/models.py b/moto/iot/models.py index 35efa6905..2790a1178 100644 --- a/moto/iot/models.py +++ b/moto/iot/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import hashlib import random import re diff --git a/moto/iot/responses.py b/moto/iot/responses.py index 572cfd99d..49f6bd710 100644 --- a/moto/iot/responses.py +++ b/moto/iot/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from urllib.parse import unquote diff --git a/moto/iot/urls.py b/moto/iot/urls.py index 086720bbc..1425e2818 100644 --- a/moto/iot/urls.py +++ b/moto/iot/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import IoTResponse url_bases = [r"https?://iot\.(.+)\.amazonaws\.com"] diff --git a/moto/iotdata/__init__.py b/moto/iotdata/__init__.py index 016fef5fb..d0c36ae63 100644 --- a/moto/iotdata/__init__.py +++ b/moto/iotdata/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import iotdata_backends from ..core.models import base_decorator diff --git a/moto/iotdata/exceptions.py b/moto/iotdata/exceptions.py index 30998ffc3..c36848546 100644 --- a/moto/iotdata/exceptions.py +++ b/moto/iotdata/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/iotdata/models.py b/moto/iotdata/models.py index 10d7c2538..f7903c406 100644 --- a/moto/iotdata/models.py +++ b/moto/iotdata/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import time import jsondiff diff --git a/moto/iotdata/responses.py b/moto/iotdata/responses.py index c7121f379..0865daaef 100644 --- a/moto/iotdata/responses.py +++ b/moto/iotdata/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import iotdata_backends import json diff --git a/moto/iotdata/urls.py b/moto/iotdata/urls.py index 8ecd3db98..695e34d15 100644 --- a/moto/iotdata/urls.py +++ b/moto/iotdata/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import IoTDataPlaneResponse url_bases = [r"https?://data\.iot\.(.+)\.amazonaws.com"] diff --git a/moto/kinesis/__init__.py b/moto/kinesis/__init__.py index 823379cd5..4f65a3d14 100644 --- a/moto/kinesis/__init__.py +++ b/moto/kinesis/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import kinesis_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/kinesis/exceptions.py b/moto/kinesis/exceptions.py index 1f25d6720..9aa8a6f94 100644 --- a/moto/kinesis/exceptions.py +++ b/moto/kinesis/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest from moto.core import ACCOUNT_ID diff --git a/moto/kinesis/models.py b/moto/kinesis/models.py index ebd6071ac..2ef3eae7a 100644 --- a/moto/kinesis/models.py +++ b/moto/kinesis/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from collections import OrderedDict import datetime import re diff --git a/moto/kinesis/responses.py b/moto/kinesis/responses.py index 287fa9e45..a3d4cf992 100644 --- a/moto/kinesis/responses.py +++ b/moto/kinesis/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/kinesis/urls.py b/moto/kinesis/urls.py index 085b35b15..cc7dec0b5 100644 --- a/moto/kinesis/urls.py +++ b/moto/kinesis/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import KinesisResponse url_bases = [ diff --git a/moto/kinesisvideo/__init__.py b/moto/kinesisvideo/__init__.py index ee79d957b..ac1bfc6a5 100644 --- a/moto/kinesisvideo/__init__.py +++ b/moto/kinesisvideo/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import kinesisvideo_backends from ..core.models import base_decorator diff --git a/moto/kinesisvideo/exceptions.py b/moto/kinesisvideo/exceptions.py index e2e119b37..4a4afe292 100644 --- a/moto/kinesisvideo/exceptions.py +++ b/moto/kinesisvideo/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import RESTError diff --git a/moto/kinesisvideo/models.py b/moto/kinesisvideo/models.py index 90d84ac02..6991616a4 100644 --- a/moto/kinesisvideo/models.py +++ b/moto/kinesisvideo/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from boto3 import Session from moto.core import BaseBackend, BaseModel from datetime import datetime diff --git a/moto/kinesisvideo/responses.py b/moto/kinesisvideo/responses.py index d1e386f2e..ea22ae818 100644 --- a/moto/kinesisvideo/responses.py +++ b/moto/kinesisvideo/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import kinesisvideo_backends import json diff --git a/moto/kinesisvideo/urls.py b/moto/kinesisvideo/urls.py index 1a6ac47d5..895120f68 100644 --- a/moto/kinesisvideo/urls.py +++ b/moto/kinesisvideo/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import KinesisVideoResponse url_bases = [ diff --git a/moto/kinesisvideoarchivedmedia/__init__.py b/moto/kinesisvideoarchivedmedia/__init__.py index c1676c871..21412ffea 100644 --- a/moto/kinesisvideoarchivedmedia/__init__.py +++ b/moto/kinesisvideoarchivedmedia/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import kinesisvideoarchivedmedia_backends from ..core.models import base_decorator diff --git a/moto/kinesisvideoarchivedmedia/exceptions.py b/moto/kinesisvideoarchivedmedia/exceptions.py index 38c60cea2..a03fd62cb 100644 --- a/moto/kinesisvideoarchivedmedia/exceptions.py +++ b/moto/kinesisvideoarchivedmedia/exceptions.py @@ -1,3 +1 @@ -from __future__ import unicode_literals - # Not implemented exceptions for now diff --git a/moto/kinesisvideoarchivedmedia/models.py b/moto/kinesisvideoarchivedmedia/models.py index 46fddf567..c1576d2ef 100644 --- a/moto/kinesisvideoarchivedmedia/models.py +++ b/moto/kinesisvideoarchivedmedia/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from boto3 import Session from moto.core import BaseBackend from moto.kinesisvideo import kinesisvideo_backends diff --git a/moto/kinesisvideoarchivedmedia/responses.py b/moto/kinesisvideoarchivedmedia/responses.py index d021ced0e..3ec4f130a 100644 --- a/moto/kinesisvideoarchivedmedia/responses.py +++ b/moto/kinesisvideoarchivedmedia/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import kinesisvideoarchivedmedia_backends import json diff --git a/moto/kinesisvideoarchivedmedia/urls.py b/moto/kinesisvideoarchivedmedia/urls.py index d424cd386..5dc4576f7 100644 --- a/moto/kinesisvideoarchivedmedia/urls.py +++ b/moto/kinesisvideoarchivedmedia/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import KinesisVideoArchivedMediaResponse url_bases = [ diff --git a/moto/kms/__init__.py b/moto/kms/__init__.py index ecedb8bfd..2bb6f8c11 100644 --- a/moto/kms/__init__.py +++ b/moto/kms/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import kms_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/kms/exceptions.py b/moto/kms/exceptions.py index 4ddfd279f..c492494ae 100644 --- a/moto/kms/exceptions.py +++ b/moto/kms/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/kms/models.py b/moto/kms/models.py index b9c52bf48..062195c1b 100644 --- a/moto/kms/models.py +++ b/moto/kms/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json import os from collections import defaultdict diff --git a/moto/kms/responses.py b/moto/kms/responses.py index 3626f6c12..7764da3d6 100644 --- a/moto/kms/responses.py +++ b/moto/kms/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import json import os diff --git a/moto/kms/urls.py b/moto/kms/urls.py index 38c164868..b91772c64 100644 --- a/moto/kms/urls.py +++ b/moto/kms/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import KmsResponse url_bases = [r"https?://kms\.(.+)\.amazonaws\.com"] diff --git a/moto/kms/utils.py b/moto/kms/utils.py index 4eacba1a6..d71ec688b 100644 --- a/moto/kms/utils.py +++ b/moto/kms/utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from collections import namedtuple import io import os diff --git a/moto/logs/exceptions.py b/moto/logs/exceptions.py index 696cfc332..c34f462f1 100644 --- a/moto/logs/exceptions.py +++ b/moto/logs/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/managedblockchain/__init__.py b/moto/managedblockchain/__init__.py index a95fa7351..d7fb14f6e 100644 --- a/moto/managedblockchain/__init__.py +++ b/moto/managedblockchain/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import managedblockchain_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/managedblockchain/exceptions.py b/moto/managedblockchain/exceptions.py index 4758c7971..96e15f0d7 100644 --- a/moto/managedblockchain/exceptions.py +++ b/moto/managedblockchain/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from functools import wraps from werkzeug.exceptions import HTTPException from jinja2 import DictLoader, Environment diff --git a/moto/managedblockchain/models.py b/moto/managedblockchain/models.py index 233e875c3..92ee562ff 100644 --- a/moto/managedblockchain/models.py +++ b/moto/managedblockchain/models.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals, division +from __future__ import division import datetime import re diff --git a/moto/managedblockchain/responses.py b/moto/managedblockchain/responses.py index b5f1ead41..570350335 100644 --- a/moto/managedblockchain/responses.py +++ b/moto/managedblockchain/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from urllib.parse import urlparse, parse_qs diff --git a/moto/managedblockchain/urls.py b/moto/managedblockchain/urls.py index 0e5fad266..6fa1c1109 100644 --- a/moto/managedblockchain/urls.py +++ b/moto/managedblockchain/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ManagedBlockchainResponse url_bases = [r"https?://managedblockchain\.(.+)\.amazonaws.com"] diff --git a/moto/mediaconnect/__init__.py b/moto/mediaconnect/__init__.py index 0528d8c20..e930e79e6 100644 --- a/moto/mediaconnect/__init__.py +++ b/moto/mediaconnect/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import mediaconnect_backends from ..core.models import base_decorator diff --git a/moto/mediaconnect/exceptions.py b/moto/mediaconnect/exceptions.py index 2272827fc..52ee30f5a 100644 --- a/moto/mediaconnect/exceptions.py +++ b/moto/mediaconnect/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/mediaconnect/models.py b/moto/mediaconnect/models.py index 907faac5e..857a98a7c 100644 --- a/moto/mediaconnect/models.py +++ b/moto/mediaconnect/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from collections import OrderedDict from uuid import uuid4 diff --git a/moto/mediaconnect/responses.py b/moto/mediaconnect/responses.py index b6c0bf3ed..052e8de0d 100644 --- a/moto/mediaconnect/responses.py +++ b/moto/mediaconnect/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/mediaconnect/urls.py b/moto/mediaconnect/urls.py index 540e21870..e124d2520 100644 --- a/moto/mediaconnect/urls.py +++ b/moto/mediaconnect/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import MediaConnectResponse url_bases = [ diff --git a/moto/medialive/__init__.py b/moto/medialive/__init__.py index d25d2beda..61ca211fb 100644 --- a/moto/medialive/__init__.py +++ b/moto/medialive/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import medialive_backends from ..core.models import base_decorator diff --git a/moto/medialive/exceptions.py b/moto/medialive/exceptions.py index baffc4882..e69de29bb 100644 --- a/moto/medialive/exceptions.py +++ b/moto/medialive/exceptions.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/moto/medialive/models.py b/moto/medialive/models.py index 023fe5bb9..34cd2415a 100644 --- a/moto/medialive/models.py +++ b/moto/medialive/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from collections import OrderedDict from uuid import uuid4 diff --git a/moto/medialive/responses.py b/moto/medialive/responses.py index 2c8568bb5..fea4f2112 100644 --- a/moto/medialive/responses.py +++ b/moto/medialive/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import medialive_backends import json diff --git a/moto/medialive/urls.py b/moto/medialive/urls.py index 38a27910e..62e89eb80 100644 --- a/moto/medialive/urls.py +++ b/moto/medialive/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import MediaLiveResponse url_bases = [ diff --git a/moto/mediapackage/__init__.py b/moto/mediapackage/__init__.py index 7e2ed7d52..e7561de2b 100644 --- a/moto/mediapackage/__init__.py +++ b/moto/mediapackage/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import mediapackage_backends from ..core.models import base_decorator diff --git a/moto/mediapackage/exceptions.py b/moto/mediapackage/exceptions.py index 4aec6f98f..c2baf42f3 100644 --- a/moto/mediapackage/exceptions.py +++ b/moto/mediapackage/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import JsonRESTError diff --git a/moto/mediapackage/models.py b/moto/mediapackage/models.py index 744a3fd21..debb58819 100644 --- a/moto/mediapackage/models.py +++ b/moto/mediapackage/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from collections import OrderedDict from boto3 import Session diff --git a/moto/mediapackage/responses.py b/moto/mediapackage/responses.py index 633abef67..b08707a81 100644 --- a/moto/mediapackage/responses.py +++ b/moto/mediapackage/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import mediapackage_backends import json diff --git a/moto/mediapackage/urls.py b/moto/mediapackage/urls.py index f44b5fb18..943e9fe55 100644 --- a/moto/mediapackage/urls.py +++ b/moto/mediapackage/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import MediaPackageResponse url_bases = [ diff --git a/moto/mediastore/__init__.py b/moto/mediastore/__init__.py index 35bf5778f..420866c4c 100644 --- a/moto/mediastore/__init__.py +++ b/moto/mediastore/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import mediastore_backends from ..core.models import base_decorator diff --git a/moto/mediastore/exceptions.py b/moto/mediastore/exceptions.py index ce7c9bbca..5c4a77dfa 100644 --- a/moto/mediastore/exceptions.py +++ b/moto/mediastore/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import JsonRESTError diff --git a/moto/mediastore/models.py b/moto/mediastore/models.py index 10e6063ad..2468b12ad 100644 --- a/moto/mediastore/models.py +++ b/moto/mediastore/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from collections import OrderedDict from datetime import date diff --git a/moto/mediastore/responses.py b/moto/mediastore/responses.py index 72f0f25aa..4c3d2938b 100644 --- a/moto/mediastore/responses.py +++ b/moto/mediastore/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/mediastore/urls.py b/moto/mediastore/urls.py index 9034be1e3..90e403d86 100644 --- a/moto/mediastore/urls.py +++ b/moto/mediastore/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import MediaStoreResponse url_bases = [r"https?://mediastore\.(.+)\.amazonaws\.com"] diff --git a/moto/mediastoredata/__init__.py b/moto/mediastoredata/__init__.py index 84ce5cdb5..9b8df256c 100644 --- a/moto/mediastoredata/__init__.py +++ b/moto/mediastoredata/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import mediastoredata_backends from ..core.models import base_decorator diff --git a/moto/mediastoredata/exceptions.py b/moto/mediastoredata/exceptions.py index 056bbf69e..305631781 100644 --- a/moto/mediastoredata/exceptions.py +++ b/moto/mediastoredata/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import JsonRESTError diff --git a/moto/mediastoredata/models.py b/moto/mediastoredata/models.py index fede0fb02..81777080f 100644 --- a/moto/mediastoredata/models.py +++ b/moto/mediastoredata/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import hashlib from collections import OrderedDict diff --git a/moto/mediastoredata/responses.py b/moto/mediastoredata/responses.py index b20218013..a38ab3bbd 100644 --- a/moto/mediastoredata/responses.py +++ b/moto/mediastoredata/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/mediastoredata/urls.py b/moto/mediastoredata/urls.py index fecf21acc..64d1c8f82 100644 --- a/moto/mediastoredata/urls.py +++ b/moto/mediastoredata/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import MediaStoreDataResponse url_bases = [ diff --git a/moto/opsworks/__init__.py b/moto/opsworks/__init__.py index e0e6b88d0..ce8c4a223 100644 --- a/moto/opsworks/__init__.py +++ b/moto/opsworks/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import opsworks_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/opsworks/exceptions.py b/moto/opsworks/exceptions.py index 3867b3b90..609bf57ad 100644 --- a/moto/opsworks/exceptions.py +++ b/moto/opsworks/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest diff --git a/moto/opsworks/models.py b/moto/opsworks/models.py index 888505a08..5e23b6a80 100644 --- a/moto/opsworks/models.py +++ b/moto/opsworks/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core import BaseBackend, BaseModel from moto.ec2 import ec2_backends from moto.core import ACCOUNT_ID diff --git a/moto/opsworks/responses.py b/moto/opsworks/responses.py index 870b75244..a11eef787 100644 --- a/moto/opsworks/responses.py +++ b/moto/opsworks/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/opsworks/urls.py b/moto/opsworks/urls.py index 4e3e4f33f..6b448d418 100644 --- a/moto/opsworks/urls.py +++ b/moto/opsworks/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import OpsWorksResponse # AWS OpsWorks has a single endpoint: opsworks.us-east-1.amazonaws.com diff --git a/moto/organizations/__init__.py b/moto/organizations/__init__.py index 372782dd3..556038b6f 100644 --- a/moto/organizations/__init__.py +++ b/moto/organizations/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import organizations_backend from ..core.models import base_decorator diff --git a/moto/organizations/exceptions.py b/moto/organizations/exceptions.py index ca64b9931..ba4d2fbd7 100644 --- a/moto/organizations/exceptions.py +++ b/moto/organizations/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/organizations/models.py b/moto/organizations/models.py index fbfd92b72..baf6dcdf0 100644 --- a/moto/organizations/models.py +++ b/moto/organizations/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import re import json diff --git a/moto/organizations/responses.py b/moto/organizations/responses.py index e2e2bf28e..686f07e34 100644 --- a/moto/organizations/responses.py +++ b/moto/organizations/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from moto.core.responses import BaseResponse diff --git a/moto/organizations/urls.py b/moto/organizations/urls.py index 940afc78d..07c7ea3fa 100644 --- a/moto/organizations/urls.py +++ b/moto/organizations/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import OrganizationsResponse url_bases = [r"https?://organizations\.(.+)\.amazonaws\.com"] diff --git a/moto/organizations/utils.py b/moto/organizations/utils.py index dc0686cde..f0821b629 100644 --- a/moto/organizations/utils.py +++ b/moto/organizations/utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import random import re import string diff --git a/moto/polly/__init__.py b/moto/polly/__init__.py index 6db0215de..3bce14d12 100644 --- a/moto/polly/__init__.py +++ b/moto/polly/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import polly_backends from ..core.models import base_decorator diff --git a/moto/polly/models.py b/moto/polly/models.py index cf4c8ab03..a7f4d3fd0 100644 --- a/moto/polly/models.py +++ b/moto/polly/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from xml.etree import ElementTree as ET import datetime diff --git a/moto/polly/responses.py b/moto/polly/responses.py index 4837ba968..16e897ce5 100644 --- a/moto/polly/responses.py +++ b/moto/polly/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json import re diff --git a/moto/polly/urls.py b/moto/polly/urls.py index 3efd12853..d826e33de 100644 --- a/moto/polly/urls.py +++ b/moto/polly/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import PollyResponse url_bases = [r"https?://polly\.(.+)\.amazonaws.com"] diff --git a/moto/polly/utils.py b/moto/polly/utils.py index 253b19e13..c13404109 100644 --- a/moto/polly/utils.py +++ b/moto/polly/utils.py @@ -1,5 +1,2 @@ -from __future__ import unicode_literals - - def make_arn_for_lexicon(account_id, name, region_name): return "arn:aws:polly:{0}:{1}:lexicon/{2}".format(region_name, account_id, name) diff --git a/moto/ram/exceptions.py b/moto/ram/exceptions.py index 49e57a61a..a4b62a621 100644 --- a/moto/ram/exceptions.py +++ b/moto/ram/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/ram/responses.py b/moto/ram/responses.py index b01254007..fbc0d351d 100644 --- a/moto/ram/responses.py +++ b/moto/ram/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import ram_backends import json diff --git a/moto/ram/urls.py b/moto/ram/urls.py index 2aa2ee015..09d782e6b 100644 --- a/moto/ram/urls.py +++ b/moto/ram/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ResourceAccessManagerResponse url_bases = [r"https?://ram\.(.+)\.amazonaws.com"] diff --git a/moto/rds/__init__.py b/moto/rds/__init__.py index bd260d023..3532dd4ee 100644 --- a/moto/rds/__init__.py +++ b/moto/rds/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import rds_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/rds/exceptions.py b/moto/rds/exceptions.py index 6fe30878b..874af1e6e 100644 --- a/moto/rds/exceptions.py +++ b/moto/rds/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest diff --git a/moto/rds/models.py b/moto/rds/models.py index 5039d9a26..3450b10cb 100644 --- a/moto/rds/models.py +++ b/moto/rds/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from boto3 import Session from jinja2 import Template diff --git a/moto/rds/responses.py b/moto/rds/responses.py index e3d37effc..d53f25310 100644 --- a/moto/rds/responses.py +++ b/moto/rds/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from moto.ec2.models import ec2_backends from .models import rds_backends diff --git a/moto/rds/urls.py b/moto/rds/urls.py index 86e6ec00b..fa7946241 100644 --- a/moto/rds/urls.py +++ b/moto/rds/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import RDSResponse url_bases = [r"https?://rds(\..+)?.amazonaws.com"] diff --git a/moto/rds2/__init__.py b/moto/rds2/__init__.py index acc8564e2..0b7fbeaa6 100644 --- a/moto/rds2/__init__.py +++ b/moto/rds2/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import rds2_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/rds2/exceptions.py b/moto/rds2/exceptions.py index 52e5b91bf..758643b9a 100644 --- a/moto/rds2/exceptions.py +++ b/moto/rds2/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from jinja2 import Template from werkzeug.exceptions import BadRequest diff --git a/moto/rds2/models.py b/moto/rds2/models.py index f77323ca9..44f3fc393 100644 --- a/moto/rds2/models.py +++ b/moto/rds2/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import copy import datetime import os diff --git a/moto/rds2/responses.py b/moto/rds2/responses.py index fd16da643..c27f88cda 100644 --- a/moto/rds2/responses.py +++ b/moto/rds2/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from collections import defaultdict from moto.core.responses import BaseResponse diff --git a/moto/rds2/urls.py b/moto/rds2/urls.py index 2175c659e..95ec8b4fb 100644 --- a/moto/rds2/urls.py +++ b/moto/rds2/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import RDS2Response url_bases = [r"https?://rds\.(.+)\.amazonaws\.com", r"https?://rds\.amazonaws\.com"] diff --git a/moto/rds2/utils.py b/moto/rds2/utils.py index 90937a44c..ddc5784f8 100644 --- a/moto/rds2/utils.py +++ b/moto/rds2/utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re from collections import namedtuple diff --git a/moto/redshift/__init__.py b/moto/redshift/__init__.py index 47cbf3b58..2c538e57e 100644 --- a/moto/redshift/__init__.py +++ b/moto/redshift/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import redshift_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/redshift/exceptions.py b/moto/redshift/exceptions.py index 02d93e7e7..6711651a3 100644 --- a/moto/redshift/exceptions.py +++ b/moto/redshift/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from werkzeug.exceptions import BadRequest diff --git a/moto/redshift/models.py b/moto/redshift/models.py index 51cec80d4..7259d98b4 100644 --- a/moto/redshift/models.py +++ b/moto/redshift/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import copy import datetime diff --git a/moto/redshift/responses.py b/moto/redshift/responses.py index 45e0932ae..eec440468 100644 --- a/moto/redshift/responses.py +++ b/moto/redshift/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json import xmltodict diff --git a/moto/redshift/urls.py b/moto/redshift/urls.py index fbc31be33..fba2541fd 100644 --- a/moto/redshift/urls.py +++ b/moto/redshift/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import RedshiftResponse url_bases = [r"https?://redshift\.(.+)\.amazonaws\.com"] diff --git a/moto/redshift/utils.py b/moto/redshift/utils.py index baffc4882..e69de29bb 100644 --- a/moto/redshift/utils.py +++ b/moto/redshift/utils.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/moto/resourcegroups/__init__.py b/moto/resourcegroups/__init__.py index 13ff17307..35153ade5 100644 --- a/moto/resourcegroups/__init__.py +++ b/moto/resourcegroups/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import resourcegroups_backends from ..core.models import base_decorator diff --git a/moto/resourcegroups/exceptions.py b/moto/resourcegroups/exceptions.py index 6c0f470be..87d2bb0ba 100644 --- a/moto/resourcegroups/exceptions.py +++ b/moto/resourcegroups/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from werkzeug.exceptions import HTTPException diff --git a/moto/resourcegroups/models.py b/moto/resourcegroups/models.py index 259fe17d0..e4a52380a 100644 --- a/moto/resourcegroups/models.py +++ b/moto/resourcegroups/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from builtins import str import json diff --git a/moto/resourcegroups/responses.py b/moto/resourcegroups/responses.py index dacd87d3e..0073e0fbd 100644 --- a/moto/resourcegroups/responses.py +++ b/moto/resourcegroups/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json try: diff --git a/moto/resourcegroups/urls.py b/moto/resourcegroups/urls.py index 7483c4628..b2b33641b 100644 --- a/moto/resourcegroups/urls.py +++ b/moto/resourcegroups/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ResourceGroupsResponse url_bases = [r"https?://resource-groups(-fips)?\.(.+)\.amazonaws.com"] diff --git a/moto/resourcegroupstaggingapi/__init__.py b/moto/resourcegroupstaggingapi/__init__.py index 2dff989b6..d28d6f6db 100644 --- a/moto/resourcegroupstaggingapi/__init__.py +++ b/moto/resourcegroupstaggingapi/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import resourcegroupstaggingapi_backends from ..core.models import base_decorator diff --git a/moto/resourcegroupstaggingapi/models.py b/moto/resourcegroupstaggingapi/models.py index ac4ab2704..4ee3598f7 100644 --- a/moto/resourcegroupstaggingapi/models.py +++ b/moto/resourcegroupstaggingapi/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import uuid from boto3 import Session diff --git a/moto/resourcegroupstaggingapi/responses.py b/moto/resourcegroupstaggingapi/responses.py index 02f5b5484..a153e2bdf 100644 --- a/moto/resourcegroupstaggingapi/responses.py +++ b/moto/resourcegroupstaggingapi/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import resourcegroupstaggingapi_backends import json diff --git a/moto/resourcegroupstaggingapi/urls.py b/moto/resourcegroupstaggingapi/urls.py index 4f9f43f98..34e343bc1 100644 --- a/moto/resourcegroupstaggingapi/urls.py +++ b/moto/resourcegroupstaggingapi/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import ResourceGroupsTaggingAPIResponse url_bases = [r"https?://tagging\.(.+)\.amazonaws.com"] diff --git a/moto/route53/__init__.py b/moto/route53/__init__.py index e2bbe4c1a..7674e8808 100644 --- a/moto/route53/__init__.py +++ b/moto/route53/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import route53_backend route53_backends = {"global": route53_backend} diff --git a/moto/route53/models.py b/moto/route53/models.py index a1e5b4197..09a458e96 100644 --- a/moto/route53/models.py +++ b/moto/route53/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import itertools from collections import defaultdict diff --git a/moto/route53/responses.py b/moto/route53/responses.py index 5165a2fbb..e0563e4a0 100644 --- a/moto/route53/responses.py +++ b/moto/route53/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from jinja2 import Template from urllib.parse import parse_qs, urlparse diff --git a/moto/route53/urls.py b/moto/route53/urls.py index fc9c81007..6574d051f 100644 --- a/moto/route53/urls.py +++ b/moto/route53/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import Route53 url_bases = [r"https?://route53(.*)\.amazonaws.com"] diff --git a/moto/s3/__init__.py b/moto/s3/__init__.py index 84c1cbde0..ccb3168be 100644 --- a/moto/s3/__init__.py +++ b/moto/s3/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import s3_backend s3_backends = {"global": s3_backend} diff --git a/moto/s3/exceptions.py b/moto/s3/exceptions.py index fa43dc37b..3ea0a716a 100644 --- a/moto/s3/exceptions.py +++ b/moto/s3/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import RESTError ERROR_WITH_BUCKET_NAME = """{% extends 'single_error' %} diff --git a/moto/s3/models.py b/moto/s3/models.py index dd49550a6..5d80be713 100644 --- a/moto/s3/models.py +++ b/moto/s3/models.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- import json import os import base64 diff --git a/moto/s3/responses.py b/moto/s3/responses.py index 73115d32c..51742ccad 100644 --- a/moto/s3/responses.py +++ b/moto/s3/responses.py @@ -1,17 +1,10 @@ -from __future__ import unicode_literals - import io import os import re -import sys from botocore.awsrequest import AWSPreparedRequest -from moto.core.utils import ( - amzn_request_id, - str_to_rfc_1123_datetime, - py2_strip_unicode_keys, -) +from moto.core.utils import amzn_request_id, str_to_rfc_1123_datetime from urllib.parse import ( parse_qs, parse_qsl, @@ -669,14 +662,6 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin): parsed_xml = xmltodict.parse(body) parsed_xml["PublicAccessBlockConfiguration"].pop("@xmlns", None) - # If Python 2, fix the unicode strings: - if sys.version_info[0] < 3: - parsed_xml = { - "PublicAccessBlockConfiguration": py2_strip_unicode_keys( - dict(parsed_xml["PublicAccessBlockConfiguration"]) - ) - } - return parsed_xml def _bucket_response_put( diff --git a/moto/s3/urls.py b/moto/s3/urls.py index f65cb167a..02502e6d0 100644 --- a/moto/s3/urls.py +++ b/moto/s3/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import S3ResponseInstance url_bases = [ diff --git a/moto/s3/utils.py b/moto/s3/utils.py index 48e5076dd..89b91b36e 100644 --- a/moto/s3/utils.py +++ b/moto/s3/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import logging import re diff --git a/moto/s3bucket_path/__init__.py b/moto/s3bucket_path/__init__.py index baffc4882..e69de29bb 100644 --- a/moto/s3bucket_path/__init__.py +++ b/moto/s3bucket_path/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/moto/s3bucket_path/utils.py b/moto/s3bucket_path/utils.py index ada2c5268..bdf3e769b 100644 --- a/moto/s3bucket_path/utils.py +++ b/moto/s3bucket_path/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from urllib.parse import urlparse diff --git a/moto/sagemaker/__init__.py b/moto/sagemaker/__init__.py index 85e635380..afd123765 100644 --- a/moto/sagemaker/__init__.py +++ b/moto/sagemaker/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import sagemaker_backends sagemaker_backend = sagemaker_backends["us-east-1"] diff --git a/moto/sagemaker/exceptions.py b/moto/sagemaker/exceptions.py index 43ccbf554..f157214c0 100644 --- a/moto/sagemaker/exceptions.py +++ b/moto/sagemaker/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError, JsonRESTError, AWSError ERROR_WITH_MODEL_NAME = """{% extends 'single_error' %} diff --git a/moto/sagemaker/models.py b/moto/sagemaker/models.py index 47fce08d2..1b8b03c07 100644 --- a/moto/sagemaker/models.py +++ b/moto/sagemaker/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import os from boto3 import Session from datetime import datetime diff --git a/moto/sagemaker/responses.py b/moto/sagemaker/responses.py index c92527c6b..2ef014b2c 100644 --- a/moto/sagemaker/responses.py +++ b/moto/sagemaker/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.sagemaker.exceptions import AWSValidationException diff --git a/moto/sagemaker/urls.py b/moto/sagemaker/urls.py index 5645fdfc1..292d3ed8f 100644 --- a/moto/sagemaker/urls.py +++ b/moto/sagemaker/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import SageMakerResponse url_bases = [ diff --git a/moto/secretsmanager/__init__.py b/moto/secretsmanager/__init__.py index 5d41d07ae..0be3a35dd 100644 --- a/moto/secretsmanager/__init__.py +++ b/moto/secretsmanager/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import secretsmanager_backends from ..core.models import base_decorator diff --git a/moto/secretsmanager/exceptions.py b/moto/secretsmanager/exceptions.py index 6618cd3ac..9725e0609 100644 --- a/moto/secretsmanager/exceptions.py +++ b/moto/secretsmanager/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/secretsmanager/models.py b/moto/secretsmanager/models.py index f19fd776e..893785094 100644 --- a/moto/secretsmanager/models.py +++ b/moto/secretsmanager/models.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import time import json import uuid diff --git a/moto/secretsmanager/responses.py b/moto/secretsmanager/responses.py index f15630fad..a96f5fbfa 100644 --- a/moto/secretsmanager/responses.py +++ b/moto/secretsmanager/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from moto.secretsmanager.exceptions import ( InvalidRequestException, diff --git a/moto/secretsmanager/urls.py b/moto/secretsmanager/urls.py index d06b28e4a..218588f6d 100644 --- a/moto/secretsmanager/urls.py +++ b/moto/secretsmanager/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import SecretsManagerResponse url_bases = [r"https?://secretsmanager\.(.+)\.amazonaws\.com"] diff --git a/moto/secretsmanager/utils.py b/moto/secretsmanager/utils.py index b79021833..f214708ec 100644 --- a/moto/secretsmanager/utils.py +++ b/moto/secretsmanager/utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import random import string import re diff --git a/moto/server.py b/moto/server.py index 7fdc5671a..616d3bad9 100644 --- a/moto/server.py +++ b/moto/server.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import argparse import io import json diff --git a/moto/ses/__init__.py b/moto/ses/__init__.py index 0477d2623..fef560572 100644 --- a/moto/ses/__init__.py +++ b/moto/ses/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import ses_backend ses_backends = {"global": ses_backend} diff --git a/moto/ses/exceptions.py b/moto/ses/exceptions.py index 42f9a77bd..7fdf9ec61 100644 --- a/moto/ses/exceptions.py +++ b/moto/ses/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/ses/models.py b/moto/ses/models.py index 8c252cc08..e066dedc6 100644 --- a/moto/ses/models.py +++ b/moto/ses/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re import json import email diff --git a/moto/ses/responses.py b/moto/ses/responses.py index 8ce124b96..4376eeb41 100644 --- a/moto/ses/responses.py +++ b/moto/ses/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import base64 from moto.core.responses import BaseResponse diff --git a/moto/ses/urls.py b/moto/ses/urls.py index 61f3f75a5..846f86d5a 100644 --- a/moto/ses/urls.py +++ b/moto/ses/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import EmailResponse url_bases = [ diff --git a/moto/ses/utils.py b/moto/ses/utils.py index 6d9151cea..a37f0d55f 100644 --- a/moto/ses/utils.py +++ b/moto/ses/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string diff --git a/moto/sns/__init__.py b/moto/sns/__init__.py index 896735b43..bc9e5dc43 100644 --- a/moto/sns/__init__.py +++ b/moto/sns/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import sns_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/sns/exceptions.py b/moto/sns/exceptions.py index 686a9a30a..5ba6eef6c 100644 --- a/moto/sns/exceptions.py +++ b/moto/sns/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/sns/models.py b/moto/sns/models.py index 05e7feae2..cbff22029 100644 --- a/moto/sns/models.py +++ b/moto/sns/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import uuid import json diff --git a/moto/sns/responses.py b/moto/sns/responses.py index f73c03827..7538c5fa7 100644 --- a/moto/sns/responses.py +++ b/moto/sns/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import re from collections import defaultdict diff --git a/moto/sns/urls.py b/moto/sns/urls.py index ff4a09ea8..5846c4f0a 100644 --- a/moto/sns/urls.py +++ b/moto/sns/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import SNSResponse url_bases = [r"https?://sns\.(.+)\.amazonaws\.com"] diff --git a/moto/sns/utils.py b/moto/sns/utils.py index a46b84ac2..41839c372 100644 --- a/moto/sns/utils.py +++ b/moto/sns/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import re import uuid diff --git a/moto/sqs/__init__.py b/moto/sqs/__init__.py index b2617b4e4..21264d09e 100644 --- a/moto/sqs/__init__.py +++ b/moto/sqs/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import sqs_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/sqs/exceptions.py b/moto/sqs/exceptions.py index 2ff7d2ebf..18b3dd611 100644 --- a/moto/sqs/exceptions.py +++ b/moto/sqs/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/sqs/models.py b/moto/sqs/models.py index 56a2988dd..fdf4d2c34 100644 --- a/moto/sqs/models.py +++ b/moto/sqs/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import hashlib import json diff --git a/moto/sqs/responses.py b/moto/sqs/responses.py index f45f00f24..144da0623 100644 --- a/moto/sqs/responses.py +++ b/moto/sqs/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re from moto.core.exceptions import RESTError diff --git a/moto/sqs/urls.py b/moto/sqs/urls.py index b1202fe3f..696ef3aa0 100644 --- a/moto/sqs/urls.py +++ b/moto/sqs/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import SQSResponse url_bases = [r"https?://(.*\.)?(queue|sqs)\.(.*\.)?amazonaws\.com"] diff --git a/moto/sqs/utils.py b/moto/sqs/utils.py index b490813c7..24d374248 100644 --- a/moto/sqs/utils.py +++ b/moto/sqs/utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string diff --git a/moto/ssm/__init__.py b/moto/ssm/__init__.py index 18112544a..9752e375f 100644 --- a/moto/ssm/__init__.py +++ b/moto/ssm/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import ssm_backends from ..core.models import base_decorator diff --git a/moto/ssm/exceptions.py b/moto/ssm/exceptions.py index d904deabe..b24e580d1 100644 --- a/moto/ssm/exceptions.py +++ b/moto/ssm/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import JsonRESTError diff --git a/moto/ssm/models.py b/moto/ssm/models.py index 5047771dc..cf54f83df 100644 --- a/moto/ssm/models.py +++ b/moto/ssm/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re from dataclasses import dataclass from typing import Dict diff --git a/moto/ssm/responses.py b/moto/ssm/responses.py index b3855782e..b4b5892eb 100644 --- a/moto/ssm/responses.py +++ b/moto/ssm/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from moto.core.responses import BaseResponse diff --git a/moto/ssm/urls.py b/moto/ssm/urls.py index e470f457f..58065ae7a 100644 --- a/moto/ssm/urls.py +++ b/moto/ssm/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import SimpleSystemManagerResponse url_bases = [ diff --git a/moto/stepfunctions/__init__.py b/moto/stepfunctions/__init__.py index 6dd50c9dc..11e933422 100644 --- a/moto/stepfunctions/__init__.py +++ b/moto/stepfunctions/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import stepfunction_backends from ..core.models import base_decorator diff --git a/moto/stepfunctions/exceptions.py b/moto/stepfunctions/exceptions.py index 9598c65f9..1e6a5b73b 100644 --- a/moto/stepfunctions/exceptions.py +++ b/moto/stepfunctions/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import AWSError diff --git a/moto/stepfunctions/responses.py b/moto/stepfunctions/responses.py index c34b8c433..18cdc156c 100644 --- a/moto/stepfunctions/responses.py +++ b/moto/stepfunctions/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/stepfunctions/urls.py b/moto/stepfunctions/urls.py index 6b516fc6c..cd516b89e 100644 --- a/moto/stepfunctions/urls.py +++ b/moto/stepfunctions/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import StepFunctionResponse url_bases = [r"https?://states\.(.+)\.amazonaws.com"] diff --git a/moto/sts/__init__.py b/moto/sts/__init__.py index 7b46bdfbd..d3839a8c0 100644 --- a/moto/sts/__init__.py +++ b/moto/sts/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import sts_backend sts_backends = {"global": sts_backend} diff --git a/moto/sts/exceptions.py b/moto/sts/exceptions.py index 1acda9288..feae83191 100644 --- a/moto/sts/exceptions.py +++ b/moto/sts/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/sts/models.py b/moto/sts/models.py index 730a21d0d..aac153096 100644 --- a/moto/sts/models.py +++ b/moto/sts/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from base64 import b64decode import datetime import xmltodict diff --git a/moto/sts/responses.py b/moto/sts/responses.py index 9af2c3e12..98f7a5d97 100644 --- a/moto/sts/responses.py +++ b/moto/sts/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.responses import BaseResponse from moto.core import ACCOUNT_ID from moto.iam import iam_backend diff --git a/moto/sts/urls.py b/moto/sts/urls.py index 46a2af326..f7c8b1178 100644 --- a/moto/sts/urls.py +++ b/moto/sts/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import TokenResponse url_bases = [r"https?://sts\.(.*\.)?amazonaws\.com"] diff --git a/moto/support/__init__.py b/moto/support/__init__.py index da0db7406..33f8d57ad 100644 --- a/moto/support/__init__.py +++ b/moto/support/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import support_backends from ..core.models import base_decorator diff --git a/moto/support/exceptions.py b/moto/support/exceptions.py index baffc4882..e69de29bb 100644 --- a/moto/support/exceptions.py +++ b/moto/support/exceptions.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/moto/support/models.py b/moto/support/models.py index 4e0bd85d5..7a9f5f26d 100644 --- a/moto/support/models.py +++ b/moto/support/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from boto3 import Session from moto.core import BaseBackend from moto.utilities.utils import load_resource diff --git a/moto/support/responses.py b/moto/support/responses.py index e446dc563..a14b90dd2 100644 --- a/moto/support/responses.py +++ b/moto/support/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.responses import BaseResponse from .models import support_backends import json diff --git a/moto/support/urls.py b/moto/support/urls.py index 66a832b58..7b232c97f 100644 --- a/moto/support/urls.py +++ b/moto/support/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import SupportResponse url_bases = [r"https?://support\.(.+)\.amazonaws\.com"] diff --git a/moto/swf/__init__.py b/moto/swf/__init__.py index 2a500458e..12fc6a9a8 100644 --- a/moto/swf/__init__.py +++ b/moto/swf/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import swf_backends from ..core.models import base_decorator, deprecated_base_decorator diff --git a/moto/swf/exceptions.py b/moto/swf/exceptions.py index def30b313..3f6f63928 100644 --- a/moto/swf/exceptions.py +++ b/moto/swf/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core.exceptions import JsonRESTError diff --git a/moto/swf/models/__init__.py b/moto/swf/models/__init__.py index 90169cc68..4f0b9be17 100644 --- a/moto/swf/models/__init__.py +++ b/moto/swf/models/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from boto3 import Session from moto.core import BaseBackend diff --git a/moto/swf/models/activity_task.py b/moto/swf/models/activity_task.py index 5c160acc4..4a3b20a4c 100644 --- a/moto/swf/models/activity_task.py +++ b/moto/swf/models/activity_task.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from datetime import datetime import uuid diff --git a/moto/swf/models/decision_task.py b/moto/swf/models/decision_task.py index aaf810f08..980d5c12f 100644 --- a/moto/swf/models/decision_task.py +++ b/moto/swf/models/decision_task.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from datetime import datetime import uuid diff --git a/moto/swf/models/domain.py b/moto/swf/models/domain.py index 789b74e63..71c640915 100644 --- a/moto/swf/models/domain.py +++ b/moto/swf/models/domain.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from collections import defaultdict from moto.core import ACCOUNT_ID, BaseModel diff --git a/moto/swf/models/generic_type.py b/moto/swf/models/generic_type.py index 8ae6ebc08..7f832ac0a 100644 --- a/moto/swf/models/generic_type.py +++ b/moto/swf/models/generic_type.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core import BaseModel from moto.core.utils import camelcase_to_underscores diff --git a/moto/swf/models/history_event.py b/moto/swf/models/history_event.py index f259ea94e..987d3a104 100644 --- a/moto/swf/models/history_event.py +++ b/moto/swf/models/history_event.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from moto.core import BaseModel from moto.core.utils import underscores_to_camelcase, unix_time diff --git a/moto/swf/models/workflow_execution.py b/moto/swf/models/workflow_execution.py index 035a47558..3b11936af 100644 --- a/moto/swf/models/workflow_execution.py +++ b/moto/swf/models/workflow_execution.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import uuid from moto.core import BaseModel diff --git a/moto/transcribe/__init__.py b/moto/transcribe/__init__.py index 9c4a7ba2e..c3600402a 100644 --- a/moto/transcribe/__init__.py +++ b/moto/transcribe/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .models import transcribe_backends transcribe_backend = transcribe_backends["us-east-1"] diff --git a/moto/transcribe/responses.py b/moto/transcribe/responses.py index e40706342..af26f41a7 100644 --- a/moto/transcribe/responses.py +++ b/moto/transcribe/responses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from moto.core.responses import BaseResponse diff --git a/moto/transcribe/urls.py b/moto/transcribe/urls.py index 838f3f8a1..2ba8069b5 100644 --- a/moto/transcribe/urls.py +++ b/moto/transcribe/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import TranscribeResponse url_bases = [r"https?://transcribe\.(.+)\.amazonaws\.com"] diff --git a/moto/wafv2/__init__.py b/moto/wafv2/__init__.py index e704ec2f4..5c984e3cc 100644 --- a/moto/wafv2/__init__.py +++ b/moto/wafv2/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .models import wafv2_backends from ..core.models import base_decorator diff --git a/moto/wafv2/exceptions.py b/moto/wafv2/exceptions.py index 54b8ddfda..c11808023 100644 --- a/moto/wafv2/exceptions.py +++ b/moto/wafv2/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.core.exceptions import RESTError diff --git a/moto/wafv2/models.py b/moto/wafv2/models.py index 8b234ca9e..f15845f19 100644 --- a/moto/wafv2/models.py +++ b/moto/wafv2/models.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from uuid import uuid4 from boto3 import Session from moto.core import BaseBackend, BaseModel diff --git a/moto/wafv2/responses.py b/moto/wafv2/responses.py index 3055a83e0..103f7b39c 100644 --- a/moto/wafv2/responses.py +++ b/moto/wafv2/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json from moto.core.utils import amzn_request_id diff --git a/moto/wafv2/urls.py b/moto/wafv2/urls.py index bea10199c..86725f2b2 100644 --- a/moto/wafv2/urls.py +++ b/moto/wafv2/urls.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from .responses import WAFV2Response url_bases = [ diff --git a/moto/xray/__init__.py b/moto/xray/__init__.py index c6c612250..381d9da51 100644 --- a/moto/xray/__init__.py +++ b/moto/xray/__init__.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .models import xray_backends from ..core.models import base_decorator from .mock_client import mock_xray_client, XRaySegment # noqa diff --git a/moto/xray/models.py b/moto/xray/models.py index 3f071f6ba..a7d8c8a00 100644 --- a/moto/xray/models.py +++ b/moto/xray/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import bisect from boto3 import Session import datetime diff --git a/moto/xray/responses.py b/moto/xray/responses.py index 1c5cf8ef5..d4611c0f2 100644 --- a/moto/xray/responses.py +++ b/moto/xray/responses.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import datetime diff --git a/moto/xray/urls.py b/moto/xray/urls.py index 55c885a6e..4d366b840 100644 --- a/moto/xray/urls.py +++ b/moto/xray/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from .responses import XRayResponse url_bases = [r"https?://xray\.(.+)\.amazonaws.com"] diff --git a/setup.cfg b/setup.cfg index f907977e3..1b0084197 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,4 +11,4 @@ relative_files = True [pylint.'MESSAGES CONTROL'] disable = W,C,R,E # Check we have any tests with duplicate names (causing them to be skipped) -enable = function-redefined +enable = function-redefined, redefined-builtin, unused-variable, dangerous-default-value, W0401, W0402, W0403, W0404, W0406, W0611 diff --git a/setup.py b/setup.py index e5551e48c..eaa5cd5f1 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import unicode_literals from io import open import os import re diff --git a/tests/__init__.py b/tests/__init__.py index 1e5eabc0b..fb4a8ea14 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import logging from . import helpers # noqa diff --git a/tests/helpers.py b/tests/helpers.py index e8eeb77d0..dc4dc9a5b 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import boto from unittest import SkipTest from collections.abc import Iterable diff --git a/tests/test_acm/test_acm.py b/tests/test_acm/test_acm.py index 5c5b566f6..4bedc63c4 100644 --- a/tests/test_acm/test_acm.py +++ b/tests/test_acm/test_acm.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from moto.acm.models import AWS_ROOT_CA import os @@ -6,10 +5,10 @@ import uuid import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from cryptography.hazmat.backends import default_backend -from cryptography.hazmat.primitives import serialization, hashes +from cryptography.hazmat.primitives import serialization from freezegun import freeze_time from moto import mock_acm, mock_elb, settings from moto.core import ACCOUNT_ID diff --git a/tests/test_apigateway/test_apigateway.py b/tests/test_apigateway/test_apigateway.py index c8e77cd0b..196b6eac9 100644 --- a/tests/test_apigateway/test_apigateway.py +++ b/tests/test_apigateway/test_apigateway.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals - import json import boto3 from freezegun import freeze_time import requests -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_apigateway, mock_cognitoidp, settings -from moto.apigateway.exceptions import NoIntegrationDefined from moto.core import ACCOUNT_ID from moto.core.models import responses_mock import pytest @@ -1457,40 +1454,40 @@ def test_put_integration_validation(): types_requiring_integration_method = http_types + aws_types types_not_requiring_integration_method = ["MOCK"] - for type in types_requiring_integration_method: + for _type in types_requiring_integration_method: # Ensure that integrations of these types fail if no integrationHttpMethod is provided with pytest.raises(ClientError) as ex: client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="http://httpbin.org/robots.txt", ) ex.value.response["Error"]["Code"].should.equal("BadRequestException") ex.value.response["Error"]["Message"].should.equal( "Enumeration value for HttpMethod must be non-empty" ) - for type in types_not_requiring_integration_method: + for _type in types_not_requiring_integration_method: # Ensure that integrations of these types do not need the integrationHttpMethod client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="http://httpbin.org/robots.txt", ) - for type in http_types: + for _type in http_types: # Ensure that it works fine when providing the integrationHttpMethod-argument client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="http://httpbin.org/robots.txt", integrationHttpMethod="POST", ) - for type in ["AWS"]: + for _type in ["AWS"]: # Ensure that it works fine when providing the integrationHttpMethod + credentials client.put_integration( restApiId=api_id, @@ -1499,21 +1496,21 @@ def test_put_integration_validation(): ACCOUNT_ID ), httpMethod="GET", - type=type, + type=_type, uri="arn:aws:apigateway:us-west-2:s3:path/b/k", integrationHttpMethod="POST", ) - for type in aws_types: + for _type in aws_types: # Ensure that credentials are not required when URI points to a Lambda stream client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:012345678901:function:MyLambda/invocations", integrationHttpMethod="POST", ) - for type in ["AWS_PROXY"]: + for _type in ["AWS_PROXY"]: # Ensure that aws_proxy does not support S3 with pytest.raises(ClientError) as ex: client.put_integration( @@ -1523,7 +1520,7 @@ def test_put_integration_validation(): ACCOUNT_ID ), httpMethod="GET", - type=type, + type=_type, uri="arn:aws:apigateway:us-west-2:s3:path/b/k", integrationHttpMethod="POST", ) @@ -1531,7 +1528,7 @@ def test_put_integration_validation(): ex.value.response["Error"]["Message"].should.equal( "Integrations of type 'AWS_PROXY' currently only supports Lambda function and Firehose stream invocations." ) - for type in aws_types: + for _type in aws_types: # Ensure that the Role ARN is for the current account with pytest.raises(ClientError) as ex: client.put_integration( @@ -1539,7 +1536,7 @@ def test_put_integration_validation(): resourceId=root_id, credentials="arn:aws:iam::000000000000:role/service-role/testrole", httpMethod="GET", - type=type, + type=_type, uri="arn:aws:apigateway:us-west-2:s3:path/b/k", integrationHttpMethod="POST", ) @@ -1547,14 +1544,14 @@ def test_put_integration_validation(): ex.value.response["Error"]["Message"].should.equal( "Cross-account pass role is not allowed." ) - for type in ["AWS"]: + for _type in ["AWS"]: # Ensure that the Role ARN is specified for aws integrations with pytest.raises(ClientError) as ex: client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="arn:aws:apigateway:us-west-2:s3:path/b/k", integrationHttpMethod="POST", ) @@ -1562,14 +1559,14 @@ def test_put_integration_validation(): ex.value.response["Error"]["Message"].should.equal( "Role ARN must be specified for AWS integrations" ) - for type in http_types: + for _type in http_types: # Ensure that the URI is valid HTTP with pytest.raises(ClientError) as ex: client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="non-valid-http", integrationHttpMethod="POST", ) @@ -1577,14 +1574,14 @@ def test_put_integration_validation(): ex.value.response["Error"]["Message"].should.equal( "Invalid HTTP endpoint specified for URI" ) - for type in aws_types: + for _type in aws_types: # Ensure that the URI is an ARN with pytest.raises(ClientError) as ex: client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="non-valid-arn", integrationHttpMethod="POST", ) @@ -1592,14 +1589,14 @@ def test_put_integration_validation(): ex.value.response["Error"]["Message"].should.equal( "Invalid ARN specified in the request" ) - for type in aws_types: + for _type in aws_types: # Ensure that the URI is a valid ARN with pytest.raises(ClientError) as ex: client.put_integration( restApiId=api_id, resourceId=root_id, httpMethod="GET", - type=type, + type=_type, uri="arn:aws:iam::0000000000:role/service-role/asdf", integrationHttpMethod="POST", ) @@ -2265,7 +2262,7 @@ def test_get_usage_plans_using_key_id(): # Create 2 Usage Plans # one will be attached to an API Key, the other will remain unattached attached_plan = client.create_usage_plan(name="Attached") - unattached_plan = client.create_usage_plan(name="Unattached") + client.create_usage_plan(name="Unattached") # Create an API key # to attach to the usage plan @@ -2277,7 +2274,7 @@ def test_get_usage_plans_using_key_id(): # Attached the Usage Plan and API Key key_type = "API_KEY" payload = {"usagePlanId": attached_plan["id"], "keyId": key_id, "keyType": key_type} - response = client.create_usage_plan_key(**payload) + client.create_usage_plan_key(**payload) # All usage plans should be returned when keyId is not included all_plans = client.get_usage_plans() diff --git a/tests/test_apigateway/test_apigateway_cloudformation.py b/tests/test_apigateway/test_apigateway_cloudformation.py index 7938c6409..d6cdea3ba 100644 --- a/tests/test_apigateway/test_apigateway_cloudformation.py +++ b/tests/test_apigateway/test_apigateway_cloudformation.py @@ -1,9 +1,8 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_lambda, mock_cloudformation, mock_apigateway, mock_iam, mock_logs -from string import Template template = """{ "AWSTemplateFormatVersion": "2010-09-09", diff --git a/tests/test_apigateway/test_apigateway_validators.py b/tests/test_apigateway/test_apigateway_validators.py index 4413907ea..f2cf7220d 100644 --- a/tests/test_apigateway/test_apigateway_validators.py +++ b/tests/test_apigateway/test_apigateway_validators.py @@ -1,7 +1,6 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_apigateway -from moto.apigateway.exceptions import RequestValidatorNotFound from botocore.exceptions import ClientError import pytest diff --git a/tests/test_apigateway/test_server.py b/tests/test_apigateway/test_server.py index c191d1a05..04d87a460 100644 --- a/tests/test_apigateway/test_server.py +++ b/tests/test_apigateway/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import json import moto.server as server diff --git a/tests/test_applicationautoscaling/__init__.py b/tests/test_applicationautoscaling/__init__.py index baffc4882..e69de29bb 100644 --- a/tests/test_applicationautoscaling/__init__.py +++ b/tests/test_applicationautoscaling/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_applicationautoscaling/test_applicationautoscaling.py b/tests/test_applicationautoscaling/test_applicationautoscaling.py index 199ed7758..9974cbcf5 100644 --- a/tests/test_applicationautoscaling/test_applicationautoscaling.py +++ b/tests/test_applicationautoscaling/test_applicationautoscaling.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals - import boto3 -import botocore import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_applicationautoscaling, mock_ecs DEFAULT_REGION = "us-east-1" diff --git a/tests/test_applicationautoscaling/test_validation.py b/tests/test_applicationautoscaling/test_validation.py index ac82aab9f..9180cdef4 100644 --- a/tests/test_applicationautoscaling/test_validation.py +++ b/tests/test_applicationautoscaling/test_validation.py @@ -1,10 +1,9 @@ -from __future__ import unicode_literals import boto3 from moto import mock_applicationautoscaling, mock_ecs from moto.applicationautoscaling import models from moto.applicationautoscaling.exceptions import AWSValidationException import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from .test_applicationautoscaling import register_scalable_target @@ -24,60 +23,62 @@ DEFAULT_ROLE_ARN = "test:arn" def test_describe_scalable_targets_with_invalid_scalable_dimension_should_return_validation_exception(): client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION) - with pytest.raises(ClientError) as err: - response = client.describe_scalable_targets( + with pytest.raises(ClientError) as ex: + client.describe_scalable_targets( ServiceNamespace=DEFAULT_SERVICE_NAMESPACE, ScalableDimension="foo", ) - err.response["Error"]["Code"].should.equal("ValidationException") - err.response["Error"]["Message"].split(":")[0].should.look_like( - "1 validation error detected" - ) - err.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) + err = ex.value.response + err["Error"]["Code"].should.equal("ValidationException") + err["Error"]["Message"].split(":")[0].should.look_like( + "1 validation error detected" + ) + err["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @mock_applicationautoscaling def test_describe_scalable_targets_with_invalid_service_namespace_should_return_validation_exception(): client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION) - with pytest.raises(ClientError) as err: - response = client.describe_scalable_targets( + with pytest.raises(ClientError) as ex: + client.describe_scalable_targets( ServiceNamespace="foo", ScalableDimension=DEFAULT_SCALABLE_DIMENSION, ) - err.response["Error"]["Code"].should.equal("ValidationException") - err.response["Error"]["Message"].split(":")[0].should.look_like( - "1 validation error detected" - ) - err.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) + err = ex.value.response + err["Error"]["Code"].should.equal("ValidationException") + err["Error"]["Message"].split(":")[0].should.look_like( + "1 validation error detected" + ) + err["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @mock_applicationautoscaling def test_describe_scalable_targets_with_multiple_invalid_parameters_should_return_validation_exception(): client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION) - with pytest.raises(ClientError) as err: - response = client.describe_scalable_targets( + with pytest.raises(ClientError) as ex: + client.describe_scalable_targets( ServiceNamespace="foo", ScalableDimension="bar", ) - err.response["Error"]["Code"].should.equal("ValidationException") - err.response["Error"]["Message"].split(":")[0].should.look_like( - "2 validation errors detected" - ) - err.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) + err = ex.value.response + err["Error"]["Code"].should.equal("ValidationException") + err["Error"]["Message"].split(":")[0].should.look_like( + "2 validation errors detected" + ) + err["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @mock_ecs @mock_applicationautoscaling -def test_register_scalable_target_ecs_with_non_existent_service_should_return_validation_exception(): +def test_register_scalable_target_ecs_with_non_existent_service_should_return_clusternotfound_exception(): client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION) resource_id = "service/{}/foo".format(DEFAULT_ECS_CLUSTER) - with pytest.raises(ClientError) as err: + with pytest.raises(ClientError) as ex: register_scalable_target(client, ServiceNamespace="ecs", ResourceId=resource_id) - err.response["Error"]["Code"].should.equal("ValidationException") - err.response["Error"]["Message"].should.equal( - "ECS service doesn't exist: {}".format(resource_id) - ) - err.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) + err = ex.value.response + err["Error"]["Code"].should.equal("ClusterNotFoundException") + err["Error"]["Message"].should.equal("Cluster not found.") + err["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @pytest.mark.parametrize( diff --git a/tests/test_athena/test_athena.py b/tests/test_athena/test_athena.py index f667f2316..dfa63375c 100644 --- a/tests/test_athena/test_athena.py +++ b/tests/test_athena/test_athena.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - from botocore.exceptions import ClientError import pytest import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_athena diff --git a/tests/test_autoscaling/test_autoscaling.py b/tests/test_autoscaling/test_autoscaling.py index 204fd3d86..213ea22f5 100644 --- a/tests/test_autoscaling/test_autoscaling.py +++ b/tests/test_autoscaling/test_autoscaling.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import boto import boto3 import boto.ec2.autoscale @@ -6,7 +5,7 @@ from boto.ec2.autoscale.launchconfig import LaunchConfiguration from boto.ec2.autoscale.group import AutoScalingGroup from boto.ec2.autoscale import Tag import boto.ec2.elb -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest @@ -17,7 +16,6 @@ from moto import ( mock_elb, mock_autoscaling_deprecated, mock_ec2, - mock_cloudformation, ) from tests.helpers import requires_boto_gte @@ -684,7 +682,7 @@ def test_autoscaling_group_with_elb(): elb_conn = boto.connect_elb() zones = ["us-east-1a", "us-east-1b"] ports = [(80, 8080, "http"), (443, 8443, "tcp")] - lb = elb_conn.create_load_balancer("my-lb", zones, ports) + elb_conn.create_load_balancer("my-lb", zones, ports) instances_health = elb_conn.describe_instance_health("my-lb") instances_health.should.be.empty @@ -727,11 +725,6 @@ def test_autoscaling_group_with_elb(): elb.instances.should.have.length_of(0) -""" -Boto3 -""" - - @mock_autoscaling @mock_elb def test_describe_load_balancers(): @@ -1800,7 +1793,6 @@ def test_standby_one_instance_decrement(): response = client.describe_auto_scaling_groups(AutoScalingGroupNames=["test_asg"]) instance_to_standby = response["AutoScalingGroups"][0]["Instances"][0]["InstanceId"] - instance_to_keep = response["AutoScalingGroups"][0]["Instances"][1]["InstanceId"] ec2_client = boto3.client("ec2", region_name="us-east-1") @@ -1875,7 +1867,6 @@ def test_standby_one_instance(): response = client.describe_auto_scaling_groups(AutoScalingGroupNames=["test_asg"]) instance_to_standby = response["AutoScalingGroups"][0]["Instances"][0]["InstanceId"] - instance_to_keep = response["AutoScalingGroups"][0]["Instances"][1]["InstanceId"] ec2_client = boto3.client("ec2", region_name="us-east-1") @@ -3034,13 +3025,13 @@ def test_attach_instances(): ], } fake_instance = ec2_client.run_instances(**kwargs)["Instances"][0] - fake_lc = asg_client.create_launch_configuration( + asg_client.create_launch_configuration( LaunchConfigurationName="test_launch_configuration", ImageId="ami-pytest", InstanceType="t3.micro", KeyName="foobar", ) - fake_asg = asg_client.create_auto_scaling_group( + asg_client.create_auto_scaling_group( AutoScalingGroupName="test_asg", LaunchConfigurationName="test_launch_configuration", MinSize=0, @@ -3062,20 +3053,20 @@ def test_attach_instances(): def test_autoscaling_lifecyclehook(): mocked_networking = setup_networking() client = boto3.client("autoscaling", region_name="us-east-1") - fake_lc = client.create_launch_configuration( + client.create_launch_configuration( LaunchConfigurationName="test_launch_configuration", ImageId="ami-pytest", InstanceType="t3.micro", KeyName="foobar", ) - fake_asg = client.create_auto_scaling_group( + client.create_auto_scaling_group( AutoScalingGroupName="test_asg", LaunchConfigurationName="test_launch_configuration", MinSize=0, MaxSize=1, VPCZoneIdentifier=mocked_networking["subnet1"], ) - fake_lfh = client.put_lifecycle_hook( + client.put_lifecycle_hook( LifecycleHookName="test-lifecyclehook", AutoScalingGroupName="test_asg", LifecycleTransition="autoscaling:EC2_INSTANCE_TERMINATING", diff --git a/tests/test_autoscaling/test_autoscaling_cloudformation.py b/tests/test_autoscaling/test_autoscaling_cloudformation.py index ecea6d6fe..86711a75a 100644 --- a/tests/test_autoscaling/test_autoscaling_cloudformation.py +++ b/tests/test_autoscaling/test_autoscaling_cloudformation.py @@ -1,6 +1,6 @@ import boto3 +import sure # noqa # pylint: disable=unused-import import json -import sure # noqa from moto import mock_autoscaling, mock_cloudformation, mock_ec2, mock_elb diff --git a/tests/test_autoscaling/test_elbv2.py b/tests/test_autoscaling/test_elbv2.py index 7fbed628b..c5e2da16e 100644 --- a/tests/test_autoscaling/test_elbv2.py +++ b/tests/test_autoscaling/test_elbv2.py @@ -1,8 +1,7 @@ -from __future__ import unicode_literals import boto3 -import sure # noqa -from moto import mock_autoscaling, mock_ec2, mock_elbv2 +import sure # noqa # pylint: disable=unused-import +from moto import mock_autoscaling, mock_elbv2 from .utils import setup_networking from tests import EXAMPLE_AMI_ID diff --git a/tests/test_autoscaling/test_launch_configurations.py b/tests/test_autoscaling/test_launch_configurations.py index 8b423c40f..d5dcaf280 100644 --- a/tests/test_autoscaling/test_launch_configurations.py +++ b/tests/test_autoscaling/test_launch_configurations.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import boto @@ -9,7 +7,7 @@ from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_autoscaling_deprecated from moto import mock_autoscaling diff --git a/tests/test_autoscaling/test_policies.py b/tests/test_autoscaling/test_policies.py index 5dd0552aa..43d40ddd6 100644 --- a/tests/test_autoscaling/test_policies.py +++ b/tests/test_autoscaling/test_policies.py @@ -1,11 +1,10 @@ -from __future__ import unicode_literals import boto import boto3 from boto.ec2.autoscale.launchconfig import LaunchConfiguration from boto.ec2.autoscale.group import AutoScalingGroup from boto.ec2.autoscale.policy import ScalingPolicy +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_autoscaling_deprecated, mock_autoscaling diff --git a/tests/test_autoscaling/test_server.py b/tests/test_autoscaling/test_server.py index 17263af44..b89396217 100644 --- a/tests/test_autoscaling/test_server.py +++ b/tests/test_autoscaling/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_autoscaling/utils.py b/tests/test_autoscaling/utils.py index 8827d2693..b7fb75e6c 100644 --- a/tests/test_autoscaling/utils.py +++ b/tests/test_autoscaling/utils.py @@ -1,4 +1,3 @@ -import boto import boto3 from boto import vpc as boto_vpc from moto import mock_ec2, mock_ec2_deprecated diff --git a/tests/test_awslambda/test_awslambda_cloudformation.py b/tests/test_awslambda/test_awslambda_cloudformation.py index 1924d2c27..f28e0e079 100644 --- a/tests/test_awslambda/test_awslambda_cloudformation.py +++ b/tests/test_awslambda/test_awslambda_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import io -import sure # noqa +import sure # noqa # pylint: disable=unused-import import zipfile from botocore.exceptions import ClientError from moto import mock_cloudformation, mock_iam, mock_lambda, mock_s3, mock_sqs @@ -210,9 +210,6 @@ def test_event_source_mapping_update_from_cloudformation_json(): # Creates lambda _, lambda_stack = create_stack(cf, s3) created_fn_name = get_created_function_name(cf, lambda_stack) - created_fn_arn = lmbda.get_function(FunctionName=created_fn_name)["Configuration"][ - "FunctionArn" - ] original_template = event_source_mapping_template.substitute( { @@ -266,9 +263,6 @@ def test_event_source_mapping_delete_from_cloudformation_json(): # Creates lambda _, lambda_stack = create_stack(cf, s3) created_fn_name = get_created_function_name(cf, lambda_stack) - created_fn_arn = lmbda.get_function(FunctionName=created_fn_name)["Configuration"][ - "FunctionArn" - ] original_template = event_source_mapping_template.substitute( { diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py index 34fe9a98c..b60acc2f9 100644 --- a/tests/test_awslambda/test_lambda.py +++ b/tests/test_awslambda/test_lambda.py @@ -2,8 +2,8 @@ import botocore.client import boto3 import hashlib import json +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from freezegun import freeze_time from moto import mock_lambda, mock_s3 @@ -709,7 +709,7 @@ def test_get_function_created_with_zipfile(): conn = boto3.client("lambda", _lambda_region) function_name = str(uuid4())[0:6] zip_content = get_test_zip_file1() - result = conn.create_function( + conn.create_function( FunctionName=function_name, Runtime="python2.7", Role=get_role_name(), @@ -1092,7 +1092,7 @@ def test_update_function_s3(): zip_content_two = get_test_zip_file2() s3_conn.put_object(Bucket=bucket_name, Key="test2.zip", Body=zip_content_two) - fxn_updated = conn.update_function_code( + conn.update_function_code( FunctionName=function_name, S3Bucket=bucket_name, S3Key="test2.zip", diff --git a/tests/test_awslambda/test_lambda_concurrency.py b/tests/test_awslambda/test_lambda_concurrency.py index 1085693f1..0f2dbb3ae 100644 --- a/tests/test_awslambda/test_lambda_concurrency.py +++ b/tests/test_awslambda/test_lambda_concurrency.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_lambda from uuid import uuid4 diff --git a/tests/test_awslambda/test_lambda_eventsourcemapping.py b/tests/test_awslambda/test_lambda_eventsourcemapping.py index 03f00073c..ed045a469 100644 --- a/tests/test_awslambda/test_lambda_eventsourcemapping.py +++ b/tests/test_awslambda/test_lambda_eventsourcemapping.py @@ -3,7 +3,7 @@ import boto3 import json import pytest import time -import sure # noqa +import sure # noqa # pylint: disable=unused-import import uuid from moto import ( diff --git a/tests/test_awslambda/test_lambda_invoke.py b/tests/test_awslambda/test_lambda_invoke.py index 5288b673a..fc7189d4a 100644 --- a/tests/test_awslambda/test_lambda_invoke.py +++ b/tests/test_awslambda/test_lambda_invoke.py @@ -4,7 +4,7 @@ import boto3 import io import json import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import zipfile from moto import ( diff --git a/tests/test_awslambda/test_lambda_layers.py b/tests/test_awslambda/test_lambda_layers.py index f10e693d1..8f9614484 100644 --- a/tests/test_awslambda/test_lambda_layers.py +++ b/tests/test_awslambda/test_lambda_layers.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from freezegun import freeze_time diff --git a/tests/test_awslambda/test_policy.py b/tests/test_awslambda/test_policy.py index 92ef0087b..d6ee9fda1 100644 --- a/tests/test_awslambda/test_policy.py +++ b/tests/test_awslambda/test_policy.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import json -import sure +import sure # noqa # pylint: disable=unused-import from moto.awslambda.policy import Policy diff --git a/tests/test_batch/test_batch_cloudformation.py b/tests/test_batch/test_batch_cloudformation.py index c6a35ec53..d6f16c074 100644 --- a/tests/test_batch/test_batch_cloudformation.py +++ b/tests/test_batch/test_batch_cloudformation.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import ( mock_batch, mock_iam, @@ -61,8 +59,8 @@ def _setup(ec2_client, iam_client): @mock_iam @mock_batch def test_create_env_cf(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, _ = _get_clients() + _, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) create_environment_template = { "Resources": { @@ -113,8 +111,8 @@ def test_create_env_cf(): @mock_iam @mock_batch def test_create_job_queue_cf(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, _ = _get_clients() + _, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) create_environment_template = { "Resources": { @@ -180,8 +178,8 @@ def test_create_job_queue_cf(): @mock_iam @mock_batch def test_create_job_def_cf(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, _ = _get_clients() + _, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) create_environment_template = { "Resources": { diff --git a/tests/test_batch/test_batch_compute_envs.py b/tests/test_batch/test_batch_compute_envs.py index 77a574f86..da61548b6 100644 --- a/tests/test_batch/test_batch_compute_envs.py +++ b/tests/test_batch/test_batch_compute_envs.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - from . import _get_clients, _setup -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_batch, mock_iam, mock_ec2, mock_ecs, settings from uuid import uuid4 @@ -12,8 +10,8 @@ from uuid import uuid4 @mock_iam @mock_batch def test_create_managed_compute_environment(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, ecs_client, _, batch_client = _get_clients() + _, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -61,8 +59,8 @@ def test_create_managed_compute_environment(): @mock_iam @mock_batch def test_create_unmanaged_compute_environment(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, ecs_client, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -99,8 +97,8 @@ def test_create_unmanaged_compute_environment(): @mock_iam @mock_batch def test_describe_compute_environment(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) compute_arn = ( @@ -132,8 +130,8 @@ def test_describe_compute_environment(): @mock_iam @mock_batch def test_delete_unmanaged_compute_environment(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, ecs_client, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) batch_client.create_compute_environment( @@ -162,8 +160,8 @@ def test_delete_unmanaged_compute_environment(): @mock_iam @mock_batch def test_delete_managed_compute_environment(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, ecs_client, _, batch_client = _get_clients() + _, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) batch_client.create_compute_environment( @@ -215,8 +213,8 @@ def test_delete_managed_compute_environment(): @mock_iam @mock_batch def test_update_unmanaged_compute_environment_state(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) batch_client.create_compute_environment( diff --git a/tests/test_batch/test_batch_job_queue.py b/tests/test_batch/test_batch_job_queue.py index df1d692a8..c1d0d0b3d 100644 --- a/tests/test_batch/test_batch_job_queue.py +++ b/tests/test_batch/test_batch_job_queue.py @@ -2,7 +2,7 @@ from . import _get_clients, _setup from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_batch, mock_iam, mock_ec2, mock_ecs from uuid import uuid4 @@ -12,8 +12,8 @@ from uuid import uuid4 @mock_iam @mock_batch def test_create_job_queue(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -46,7 +46,7 @@ def test_create_job_queue(): @mock_iam @mock_batch def test_describe_job_queue_unknown_value(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + _, _, _, _, batch_client = _get_clients() resp = batch_client.describe_job_queues(jobQueues=["test_invalid_queue"]) resp.should.have.key("jobQueues").being.length_of(0) @@ -57,8 +57,8 @@ def test_describe_job_queue_unknown_value(): @mock_iam @mock_batch def test_create_job_queue_twice(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -96,7 +96,7 @@ def test_create_job_queue_twice(): @mock_iam @mock_batch def test_create_job_queue_incorrect_state(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + _, _, _, _, batch_client = _get_clients() with pytest.raises(ClientError) as ex: batch_client.create_job_queue( @@ -115,7 +115,7 @@ def test_create_job_queue_incorrect_state(): @mock_iam @mock_batch def test_create_job_queue_without_compute_environment(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + _, _, _, _, batch_client = _get_clients() with pytest.raises(ClientError) as ex: batch_client.create_job_queue( @@ -134,8 +134,8 @@ def test_create_job_queue_without_compute_environment(): @mock_iam @mock_batch def test_job_queue_bad_arn(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -165,8 +165,8 @@ def test_job_queue_bad_arn(): @mock_iam @mock_batch def test_update_job_queue(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -205,8 +205,8 @@ def test_update_job_queue(): @mock_iam @mock_batch def test_delete_job_queue(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( diff --git a/tests/test_batch/test_batch_jobs.py b/tests/test_batch/test_batch_jobs.py index b16e52333..f3d69aa10 100644 --- a/tests/test_batch/test_batch_jobs.py +++ b/tests/test_batch/test_batch_jobs.py @@ -1,7 +1,7 @@ from . import _get_clients, _setup import datetime -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_batch, mock_iam, mock_ec2, mock_ecs, mock_logs import pytest import time @@ -14,8 +14,8 @@ from uuid import uuid4 @mock_iam @mock_batch def test_submit_job_by_name(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4()) resp = batch_client.create_compute_environment( @@ -93,8 +93,8 @@ def test_submit_job_by_name(): @mock_batch @pytest.mark.network def test_submit_job(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, logs_client, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) job_def_name = str(uuid4())[0:6] commands = ["echo", "hello"] @@ -126,8 +126,8 @@ def test_submit_job(): @mock_batch @pytest.mark.network def test_list_jobs(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) job_def_name = "sleep5" commands = ["sleep", "5"] @@ -161,8 +161,8 @@ def test_list_jobs(): @mock_iam @mock_batch def test_terminate_job(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, logs_client, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) job_def_name = f"echo-sleep-echo-{str(uuid4())[0:6]}" commands = ["sh", "-c", "echo start && sleep 30 && echo stop"] @@ -201,8 +201,8 @@ def test_terminate_job(): @mock_iam @mock_batch def test_cancel_pending_job(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) # We need to be able to cancel a job that has not been started yet # Locally, our jobs start so fast that we can't cancel them in time @@ -241,8 +241,8 @@ def test_cancel_running_job(): """ Test verifies that the moment the job has started, we can't cancel anymore """ - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) job_def_name = "echo-o-o" commands = ["echo", "start"] @@ -285,8 +285,8 @@ def _wait_for_job_status(client, job_id, status, seconds_to_wait=30): @mock_iam @mock_batch def test_failed_job(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) job_def_name = "exit-1" commands = ["exit", "1"] @@ -317,8 +317,8 @@ def test_failed_job(): @mock_iam @mock_batch def test_dependencies(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, logs_client, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) job_def_arn, queue_arn = prepare_job( batch_client, @@ -403,8 +403,8 @@ def retrieve_all_streams(log_stream_name, logs_client): @mock_iam @mock_batch def test_failed_dependencies(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, _, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4())[0:6] resp = batch_client.create_compute_environment( @@ -503,8 +503,8 @@ def test_container_overrides(): # Set up environment - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() - vpc_id, subnet_id, sg_id, iam_arn = _setup(ec2_client, iam_client) + ec2_client, iam_client, _, logs_client, batch_client = _get_clients() + _, _, _, iam_arn = _setup(ec2_client, iam_client) compute_name = str(uuid4())[0:6] resp = batch_client.create_compute_environment( diff --git a/tests/test_batch/test_batch_task_definition.py b/tests/test_batch/test_batch_task_definition.py index 4f1a10d4a..092f6082e 100644 --- a/tests/test_batch/test_batch_task_definition.py +++ b/tests/test_batch/test_batch_task_definition.py @@ -1,6 +1,6 @@ from . import _get_clients, _setup import random -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_batch, mock_iam, mock_ec2, mock_ecs from uuid import uuid4 @@ -10,7 +10,7 @@ from uuid import uuid4 @mock_iam @mock_batch def test_register_task_definition(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + ec2_client, iam_client, _, _, batch_client = _get_clients() _setup(ec2_client, iam_client) resp = register_job_def(batch_client) @@ -29,7 +29,7 @@ def test_register_task_definition(): @mock_iam @mock_batch def test_register_task_definition_with_tags(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + ec2_client, iam_client, _, _, batch_client = _get_clients() _setup(ec2_client, iam_client) resp = register_job_def_with_tags(batch_client) @@ -49,7 +49,7 @@ def test_register_task_definition_with_tags(): @mock_batch def test_reregister_task_definition(): # Reregistering task with the same name bumps the revision number - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + ec2_client, iam_client, _, _, batch_client = _get_clients() _setup(ec2_client, iam_client) job_def_name = str(uuid4())[0:6] @@ -88,7 +88,7 @@ def test_reregister_task_definition(): @mock_iam @mock_batch def test_delete_task_definition(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + ec2_client, iam_client, _, _, batch_client = _get_clients() _setup(ec2_client, iam_client) resp = register_job_def(batch_client, definition_name=str(uuid4())) @@ -105,7 +105,7 @@ def test_delete_task_definition(): @mock_iam @mock_batch def test_delete_task_definition_by_name(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + ec2_client, iam_client, _, _, batch_client = _get_clients() _setup(ec2_client, iam_client) resp = register_job_def(batch_client, definition_name=str(uuid4())) @@ -122,7 +122,7 @@ def test_delete_task_definition_by_name(): @mock_iam @mock_batch def test_describe_task_definition(): - ec2_client, iam_client, ecs_client, logs_client, batch_client = _get_clients() + ec2_client, iam_client, _, _, batch_client = _get_clients() _setup(ec2_client, iam_client) sleep_def_name = f"sleep10_{str(uuid4())[0:6]}" diff --git a/tests/test_batch/test_server.py b/tests/test_batch/test_server.py index 91b5f0c47..09970ac13 100644 --- a/tests/test_batch/test_server.py +++ b/tests/test_batch/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_batch diff --git a/tests/test_cloudformation/__init__.py b/tests/test_cloudformation/__init__.py index baffc4882..e69de29bb 100644 --- a/tests/test_cloudformation/__init__.py +++ b/tests/test_cloudformation/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_cloudformation/fixtures/__init__.py b/tests/test_cloudformation/fixtures/__init__.py index baffc4882..e69de29bb 100644 --- a/tests/test_cloudformation/fixtures/__init__.py +++ b/tests/test_cloudformation/fixtures/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_cloudformation/fixtures/ec2_classic_eip.py b/tests/test_cloudformation/fixtures/ec2_classic_eip.py index fd7758300..333d80246 100644 --- a/tests/test_cloudformation/fixtures/ec2_classic_eip.py +++ b/tests/test_cloudformation/fixtures/ec2_classic_eip.py @@ -1,3 +1 @@ -from __future__ import unicode_literals - template = {"Resources": {"EC2EIP": {"Type": "AWS::EC2::EIP"}}} diff --git a/tests/test_cloudformation/fixtures/fn_join.py b/tests/test_cloudformation/fixtures/fn_join.py index ac73e3cd2..4fcb161d3 100644 --- a/tests/test_cloudformation/fixtures/fn_join.py +++ b/tests/test_cloudformation/fixtures/fn_join.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "Resources": {"EC2EIP": {"Type": "AWS::EC2::EIP"}}, "Outputs": { diff --git a/tests/test_cloudformation/fixtures/kms_key.py b/tests/test_cloudformation/fixtures/kms_key.py index af6a535d1..ab238128e 100644 --- a/tests/test_cloudformation/fixtures/kms_key.py +++ b/tests/test_cloudformation/fixtures/kms_key.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS CloudFormation Sample Template to create a KMS Key. The Fn::GetAtt is used to retrieve the ARN", diff --git a/tests/test_cloudformation/fixtures/rds_mysql_with_db_parameter_group.py b/tests/test_cloudformation/fixtures/rds_mysql_with_db_parameter_group.py index d58516d3d..b0dac055b 100644 --- a/tests/test_cloudformation/fixtures/rds_mysql_with_db_parameter_group.py +++ b/tests/test_cloudformation/fixtures/rds_mysql_with_db_parameter_group.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS CloudFormation Sample Template RDS_MySQL_With_Read_Replica: Sample template showing how to create a highly-available, RDS DBInstance with a read replica. **WARNING** This template creates an Amazon Relational Database Service database instance and Amazon CloudWatch alarms. You will be billed for the AWS resources used if you create a stack from this template.", diff --git a/tests/test_cloudformation/fixtures/rds_mysql_with_read_replica.py b/tests/test_cloudformation/fixtures/rds_mysql_with_read_replica.py index 30f2210fc..a21589966 100644 --- a/tests/test_cloudformation/fixtures/rds_mysql_with_read_replica.py +++ b/tests/test_cloudformation/fixtures/rds_mysql_with_read_replica.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS CloudFormation Sample Template RDS_MySQL_With_Read_Replica: Sample template showing how to create a highly-available, RDS DBInstance with a read replica. **WARNING** This template creates an Amazon Relational Database Service database instance and Amazon CloudWatch alarms. You will be billed for the AWS resources used if you create a stack from this template.", diff --git a/tests/test_cloudformation/fixtures/redshift.py b/tests/test_cloudformation/fixtures/redshift.py index 6da5c30db..4734f8678 100644 --- a/tests/test_cloudformation/fixtures/redshift.py +++ b/tests/test_cloudformation/fixtures/redshift.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { diff --git a/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py b/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py index 9afb097ab..1363342f7 100644 --- a/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py +++ b/tests/test_cloudformation/fixtures/route53_ec2_instance_with_public_ip.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from tests import EXAMPLE_AMI_ID template = { diff --git a/tests/test_cloudformation/fixtures/route53_health_check.py b/tests/test_cloudformation/fixtures/route53_health_check.py index 876caf299..77865b5e0 100644 --- a/tests/test_cloudformation/fixtures/route53_health_check.py +++ b/tests/test_cloudformation/fixtures/route53_health_check.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "Resources": { "HostedZone": { diff --git a/tests/test_cloudformation/fixtures/route53_roundrobin.py b/tests/test_cloudformation/fixtures/route53_roundrobin.py index 9c9f8a6f9..d21c9b3f2 100644 --- a/tests/test_cloudformation/fixtures/route53_roundrobin.py +++ b/tests/test_cloudformation/fixtures/route53_roundrobin.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "AWSTemplateFormatVersion": "2010-09-09", "Description": "AWS CloudFormation Sample Template Route53_RoundRobin: Sample template showing how to use weighted round robin (WRR) DNS entried via Amazon Route 53. This contrived sample uses weighted CNAME records to illustrate that the weighting influences the return records. It assumes that you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates one or more AWS resources. You will be billed for the AWS resources used if you create a stack from this template.", diff --git a/tests/test_cloudformation/fixtures/single_instance_with_ebs_volume.py b/tests/test_cloudformation/fixtures/single_instance_with_ebs_volume.py index 28014fee5..511d3d1b7 100644 --- a/tests/test_cloudformation/fixtures/single_instance_with_ebs_volume.py +++ b/tests/test_cloudformation/fixtures/single_instance_with_ebs_volume.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from tests import EXAMPLE_AMI_ID, EXAMPLE_AMI_ID2 template = { diff --git a/tests/test_cloudformation/fixtures/vpc_eip.py b/tests/test_cloudformation/fixtures/vpc_eip.py index 154d4c2d4..fb7bc305f 100644 --- a/tests/test_cloudformation/fixtures/vpc_eip.py +++ b/tests/test_cloudformation/fixtures/vpc_eip.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "Resources": {"VPCEIP": {"Type": "AWS::EC2::EIP", "Properties": {"Domain": "vpc"}}} } diff --git a/tests/test_cloudformation/fixtures/vpc_eni.py b/tests/test_cloudformation/fixtures/vpc_eni.py index fc2d7d61b..c304a8c8a 100644 --- a/tests/test_cloudformation/fixtures/vpc_eni.py +++ b/tests/test_cloudformation/fixtures/vpc_eni.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - template = { "AWSTemplateFormatVersion": "2010-09-09", "Description": "VPC ENI Test CloudFormation", diff --git a/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py b/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py index dba330ce4..92399192e 100644 --- a/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py +++ b/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from tests import EXAMPLE_AMI_ID template = { diff --git a/tests/test_cloudformation/test_cloudformation_stack_crud.py b/tests/test_cloudformation/test_cloudformation_stack_crud.py index 7d2428c5c..754875623 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_crud.py +++ b/tests/test_cloudformation/test_cloudformation_stack_crud.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import os import json @@ -10,8 +8,8 @@ import boto.s3 import boto.s3.key import boto.cloudformation from boto.exception import BotoServerError +import sure # noqa # pylint: disable=unused-import from freezegun import freeze_time -import sure # noqa import pytest diff --git a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py index 6bcd17b6e..949aa1a66 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py +++ b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import json from collections import OrderedDict from datetime import datetime, timedelta @@ -8,6 +6,7 @@ import pytz import boto3 from botocore.exceptions import ClientError +import sure # noqa # pylint: disable=unused-import import pytest from unittest import SkipTest @@ -1765,7 +1764,6 @@ def test_cloudformation_params_conditions_and_resources_are_distinct(): TemplateBody=template_with_conditions, Parameters=[{"ParameterKey": "FooEnabled", "ParameterValue": "true"}], ) - stack = cf.describe_stacks(StackName="test_stack1")["Stacks"][0] resources = cf.list_stack_resources(StackName="test_stack1")[ "StackResourceSummaries" ] diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py index d8c8c3935..f958b9ff5 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_integration.py +++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import io import zipfile @@ -20,7 +19,7 @@ import boto.sns import boto.sqs import boto.vpc import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from copy import deepcopy from string import Template @@ -41,7 +40,6 @@ from moto import ( mock_lambda, mock_logs, mock_rds_deprecated, - mock_rds2, mock_redshift_deprecated, mock_route53_deprecated, mock_s3, @@ -2849,6 +2847,15 @@ def test_create_log_group_using_fntransform(): }, } + cf_conn = boto3.client("cloudformation", "us-west-2") + cf_conn.create_stack( + StackName="test_stack", TemplateBody=json.dumps(template), + ) + + logs_conn = boto3.client("logs", region_name="us-west-2") + log_group = logs_conn.describe_log_groups()["logGroups"][0] + log_group["logGroupName"].should.equal("some-log-group") + @mock_cloudformation @mock_logs diff --git a/tests/test_cloudformation/test_import_value.py b/tests/test_cloudformation/test_import_value.py index 41a8a8a30..6701a3523 100644 --- a/tests/test_cloudformation/test_import_value.py +++ b/tests/test_cloudformation/test_import_value.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -from __future__ import absolute_import, division, print_function, unicode_literals +from __future__ import absolute_import, division, print_function # Standard library modules import unittest diff --git a/tests/test_cloudformation/test_server.py b/tests/test_cloudformation/test_server.py index 04d7e591a..e09d5b7d8 100644 --- a/tests/test_cloudformation/test_server.py +++ b/tests/test_cloudformation/test_server.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals - import json -from urllib.parse import urlencode import re -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_cloudformation/test_stack_parsing.py b/tests/test_cloudformation/test_stack_parsing.py index 3def8ac29..33da0b128 100644 --- a/tests/test_cloudformation/test_stack_parsing.py +++ b/tests/test_cloudformation/test_stack_parsing.py @@ -1,9 +1,8 @@ -from __future__ import unicode_literals import boto3 import json import yaml -import sure # noqa +import sure # noqa # pylint: disable=unused-import from unittest.mock import patch from moto.cloudformation.exceptions import ValidationError @@ -11,7 +10,6 @@ from moto.cloudformation.models import FakeStack from moto.cloudformation.parsing import ( resource_class_from_type, parse_condition, - Export, ) from moto import mock_ssm, settings from moto.sqs.models import Queue diff --git a/tests/test_cloudformation/test_validate.py b/tests/test_cloudformation/test_validate.py index 56d350583..baf96555d 100644 --- a/tests/test_cloudformation/test_validate.py +++ b/tests/test_cloudformation/test_validate.py @@ -1,24 +1,9 @@ -from collections import OrderedDict import json -import yaml -import os import boto3 import botocore -import sure # noqa +import sure # noqa # pylint: disable=unused-import - -from moto.cloudformation.exceptions import ValidationError -from moto.cloudformation.models import FakeStack -from moto.cloudformation.parsing import ( - resource_class_from_type, - parse_condition, - Export, -) -from moto.sqs.models import Queue -from moto.s3.models import FakeBucket -from moto.cloudformation.utils import yaml_tag_constructor -from boto.cloudformation.stack import Output -from moto import mock_cloudformation, mock_s3, mock_sqs, mock_ec2 +from moto import mock_cloudformation, mock_s3 from tests import EXAMPLE_AMI_ID json_template = { diff --git a/tests/test_cloudtrail/test_cloudtrail.py b/tests/test_cloudtrail/test_cloudtrail.py index bb75e27f2..f4392a12b 100644 --- a/tests/test_cloudtrail/test_cloudtrail.py +++ b/tests/test_cloudtrail/test_cloudtrail.py @@ -1,7 +1,7 @@ """Unit tests for cloudtrail-supported APIs.""" import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from datetime import datetime @@ -201,7 +201,7 @@ def test_get_trail_unknown(): def test_get_trail(): test_create_trail_simple() client = boto3.client("cloudtrail", region_name="us-east-1") - _, trail1, name = create_trail_simple() + _, _, name = create_trail_simple() trail = client.get_trail(Name=name)["Trail"] trail.should.have.key("Name").equal(name) trail.should.have.key("IncludeGlobalServiceEvents").equal(True) @@ -392,9 +392,9 @@ def test_describe_trails_without_shadowtrails(): def test_describe_trails_with_shadowtrails_true(): # Same behaviour as if shadowtrails-parameter was not supplied client = boto3.client("cloudtrail", region_name="us-east-1") - _, trail1, _ = create_trail_simple() - _, trail2, _, _ = create_trail_advanced() - _, trail3, _ = create_trail_simple(region_name="eu-west-1") + create_trail_simple() + create_trail_advanced() + create_trail_simple(region_name="eu-west-1") trails = client.describe_trails(includeShadowTrails=True)["trailList"] trails.should.have.length_of(3) diff --git a/tests/test_cloudtrail/test_server.py b/tests/test_cloudtrail/test_server.py index a4372f293..2735584c0 100644 --- a/tests/test_cloudtrail/test_server.py +++ b/tests/test_cloudtrail/test_server.py @@ -1,6 +1,6 @@ """Test different server responses.""" import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_cloudtrail diff --git a/tests/test_cloudwatch/test_cloudwatch.py b/tests/test_cloudwatch/test_cloudwatch.py index 7fe002bcc..b1abd2d33 100644 --- a/tests/test_cloudwatch/test_cloudwatch.py +++ b/tests/test_cloudwatch/test_cloudwatch.py @@ -1,12 +1,9 @@ import boto from boto.ec2.cloudwatch.alarm import MetricAlarm -from boto.s3.key import Key from datetime import datetime -import sure # noqa -from moto.cloudwatch.utils import make_arn_for_alarm -from moto.core import ACCOUNT_ID +import sure # noqa # pylint: disable=unused-import -from moto import mock_cloudwatch_deprecated, mock_s3_deprecated +from moto import mock_cloudwatch_deprecated def alarm_fixture(name="tester", action=None): diff --git a/tests/test_cloudwatch/test_cloudwatch_alarms.py b/tests/test_cloudwatch/test_cloudwatch_alarms.py index 503872833..02d14315a 100644 --- a/tests/test_cloudwatch/test_cloudwatch_alarms.py +++ b/tests/test_cloudwatch/test_cloudwatch_alarms.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudwatch from moto.core import ACCOUNT_ID diff --git a/tests/test_cloudwatch/test_cloudwatch_boto3.py b/tests/test_cloudwatch/test_cloudwatch_boto3.py index 7f0a436df..3b3df7e81 100644 --- a/tests/test_cloudwatch/test_cloudwatch_boto3.py +++ b/tests/test_cloudwatch/test_cloudwatch_boto3.py @@ -1,7 +1,7 @@ import boto3 import pytest import pytz -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from datetime import datetime, timedelta @@ -296,7 +296,7 @@ def test_custom_timestamp(): ], ) - stats = cw.get_metric_statistics( + cw.get_metric_statistics( Namespace="tester", MetricName="metric", StartTime=utc_now - timedelta(seconds=60), @@ -304,6 +304,7 @@ def test_custom_timestamp(): Period=60, Statistics=["SampleCount", "Sum"], ) + # TODO: What are we actually testing here? @mock_cloudwatch @@ -491,7 +492,6 @@ def test_get_metric_data_partially_within_timeframe(): cloudwatch = boto3.client("cloudwatch", "eu-west-1") namespace1 = "my_namespace/" # put metric data - values = [0, 2, 4, 3.5, 7, 100] cloudwatch.put_metric_data( Namespace=namespace1, MetricData=[ diff --git a/tests/test_cloudwatch/test_cloudwatch_dashboards.py b/tests/test_cloudwatch/test_cloudwatch_dashboards.py index 0d105e7bc..67bcd43f9 100644 --- a/tests/test_cloudwatch/test_cloudwatch_dashboards.py +++ b/tests/test_cloudwatch/test_cloudwatch_dashboards.py @@ -1,6 +1,6 @@ import boto3 from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudwatch diff --git a/tests/test_cloudwatch/test_cloudwatch_tags.py b/tests/test_cloudwatch/test_cloudwatch_tags.py index 8a72f3b0c..f3e12ed46 100644 --- a/tests/test_cloudwatch/test_cloudwatch_tags.py +++ b/tests/test_cloudwatch/test_cloudwatch_tags.py @@ -3,7 +3,7 @@ from operator import itemgetter import boto3 from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudwatch from moto.cloudwatch.utils import make_arn_for_alarm diff --git a/tests/test_codecommit/test_codecommit.py b/tests/test_codecommit/test_codecommit.py index 4c38252ff..750a6239c 100644 --- a/tests/test_codecommit/test_codecommit.py +++ b/tests/test_codecommit/test_codecommit.py @@ -1,6 +1,6 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_codecommit from moto.core import ACCOUNT_ID from botocore.exceptions import ClientError diff --git a/tests/test_codepipeline/test_codepipeline.py b/tests/test_codepipeline/test_codepipeline.py index ca1094582..10b18463c 100644 --- a/tests/test_codepipeline/test_codepipeline.py +++ b/tests/test_codepipeline/test_codepipeline.py @@ -2,7 +2,7 @@ import json from datetime import datetime import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest diff --git a/tests/test_cognitoidentity/test_cognitoidentity.py b/tests/test_cognitoidentity/test_cognitoidentity.py index 2658cfd5f..54dd26e01 100644 --- a/tests/test_cognitoidentity/test_cognitoidentity.py +++ b/tests/test_cognitoidentity/test_cognitoidentity.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest @@ -149,9 +147,9 @@ def test_describe_identity_pool_with_invalid_id_raises_error(): # testing a helper function def test_get_random_identity_id(): identity_id = get_random_identity_id("us-west-2") - region, id = identity_id.split(":") + region, identity_id = identity_id.split(":") region.should.equal("us-west-2") - UUID(id, version=4) # Will throw an error if it's not a valid UUID + UUID(identity_id, version=4) # Will throw an error if it's not a valid UUID @mock_cognitoidentity diff --git a/tests/test_cognitoidentity/test_server.py b/tests/test_cognitoidentity/test_server.py index 8c4229f06..4b47ecd2f 100644 --- a/tests/test_cognitoidentity/test_server.py +++ b/tests/test_cognitoidentity/test_server.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_cognitoidentity diff --git a/tests/test_cognitoidp/test_cognitoidp.py b/tests/test_cognitoidp/test_cognitoidp.py index 6c038a000..12abdd53b 100644 --- a/tests/test_cognitoidp/test_cognitoidp.py +++ b/tests/test_cognitoidp/test_cognitoidp.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import base64 import boto3 import json @@ -15,9 +13,9 @@ import uuid # noinspection PyUnresolvedReferences -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError, ParamValidationError -from jose import jws, jwk, jwt +from jose import jws, jwt from unittest import SkipTest import pytest @@ -158,7 +156,7 @@ def test_list_user_pools_returns_max_items(): # Given 10 user pools pool_count = 10 - for i in range(pool_count): + for _ in range(pool_count): conn.create_user_pool(PoolName=str(uuid.uuid4())) max_results = 5 @@ -173,7 +171,7 @@ def test_list_user_pools_returns_next_tokens(): # Given 10 user pool clients pool_count = 10 - for i in range(pool_count): + for _ in range(pool_count): conn.create_user_pool(PoolName=str(uuid.uuid4())) max_results = 5 @@ -193,7 +191,7 @@ def test_list_user_pools_when_max_items_more_than_total_items(): # Given 10 user pool clients pool_count = 10 - for i in range(pool_count): + for _ in range(pool_count): conn.create_user_pool(PoolName=str(uuid.uuid4())) max_results = pool_count + 5 @@ -364,7 +362,7 @@ def test_list_user_pool_clients_returns_max_items(): # Given 10 user pool clients client_count = 10 - for i in range(client_count): + for _ in range(client_count): client_name = str(uuid.uuid4()) conn.create_user_pool_client(UserPoolId=user_pool_id, ClientName=client_name) max_results = 5 @@ -382,7 +380,7 @@ def test_list_user_pool_clients_returns_next_tokens(): # Given 10 user pool clients client_count = 10 - for i in range(client_count): + for _ in range(client_count): client_name = str(uuid.uuid4()) conn.create_user_pool_client(UserPoolId=user_pool_id, ClientName=client_name) max_results = 5 @@ -407,7 +405,7 @@ def test_list_user_pool_clients_when_max_items_more_than_total_items(): # Given 10 user pool clients client_count = 10 - for i in range(client_count): + for _ in range(client_count): client_name = str(uuid.uuid4()) conn.create_user_pool_client(UserPoolId=user_pool_id, ClientName=client_name) max_results = client_count + 5 @@ -568,7 +566,7 @@ def test_list_identity_providers_returns_max_items(): # Given 10 identity providers linked to a user pool identity_provider_count = 10 - for i in range(identity_provider_count): + for _ in range(identity_provider_count): provider_name = str(uuid.uuid4()) provider_type = "Facebook" conn.create_identity_provider( @@ -593,7 +591,7 @@ def test_list_identity_providers_returns_next_tokens(): # Given 10 identity providers linked to a user pool identity_provider_count = 10 - for i in range(identity_provider_count): + for _ in range(identity_provider_count): provider_name = str(uuid.uuid4()) provider_type = "Facebook" conn.create_identity_provider( @@ -625,7 +623,7 @@ def test_list_identity_providers_when_max_items_more_than_total_items(): # Given 10 identity providers linked to a user pool identity_provider_count = 10 - for i in range(identity_provider_count): + for _ in range(identity_provider_count): provider_name = str(uuid.uuid4()) provider_type = "Facebook" conn.create_identity_provider( @@ -716,9 +714,6 @@ def test_update_identity_provider_no_user_pool(): def test_update_identity_provider_no_identity_provider(): conn = boto3.client("cognito-idp", "us-west-2") - provider_name = str(uuid.uuid4()) - provider_type = "Facebook" - value = str(uuid.uuid4()) new_value = str(uuid.uuid4()) user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"] @@ -1301,9 +1296,9 @@ def test_list_users_inherent_attributes(): ("cognito:user_status", "CONFIRMED", "UserStatus", "CONFIRMED"), ] - for filter, filter_value, response_field, response_field_expected_value in filters: + for name, filter_value, response_field, response_field_expected_value in filters: result = conn.list_users( - UserPoolId=user_pool_id, Filter='{}="{}"'.format(filter, filter_value) + UserPoolId=user_pool_id, Filter='{}="{}"'.format(name, filter_value) ) result["Users"].should.have.length_of(1) result["Users"][0][response_field].should.equal(response_field_expected_value) @@ -1334,7 +1329,7 @@ def test_list_users_returns_limit_items(): # Given 10 users user_count = 10 - for i in range(user_count): + for _ in range(user_count): conn.admin_create_user(UserPoolId=user_pool_id, Username=str(uuid.uuid4())) max_results = 5 result = conn.list_users(UserPoolId=user_pool_id, Limit=max_results) @@ -1349,7 +1344,7 @@ def test_list_users_returns_pagination_tokens(): # Given 10 users user_count = 10 - for i in range(user_count): + for _ in range(user_count): conn.admin_create_user(UserPoolId=user_pool_id, Username=str(uuid.uuid4())) max_results = 5 @@ -1372,7 +1367,7 @@ def test_list_users_when_limit_more_than_total_items(): # Given 10 users user_count = 10 - for i in range(user_count): + for _ in range(user_count): conn.admin_create_user(UserPoolId=user_pool_id, Username=str(uuid.uuid4())) max_results = user_count + 5 @@ -1836,7 +1831,6 @@ def test_resource_server(): client = boto3.client("cognito-idp", "us-west-2") name = str(uuid.uuid4()) - value = str(uuid.uuid4()) res = client.create_user_pool(PoolName=name) user_pool_id = res["UserPool"]["Id"] @@ -2061,7 +2055,7 @@ def test_initiate_auth_for_unconfirmed_user(): caught = False try: - result = conn.initiate_auth( + conn.initiate_auth( ClientId=client_id, AuthFlow="USER_SRP_AUTH", AuthParameters={ @@ -2086,9 +2080,7 @@ def test_initiate_auth_with_invalid_secret_hash(): UserPoolId=user_pool_id, ClientName=str(uuid.uuid4()), GenerateSecret=True, )["UserPoolClient"]["ClientId"] conn.sign_up(ClientId=client_id, Username=username, Password=password) - client_secret = conn.describe_user_pool_client( - UserPoolId=user_pool_id, ClientId=client_id, - )["UserPoolClient"]["ClientSecret"] + conn.describe_user_pool_client(UserPoolId=user_pool_id, ClientId=client_id) conn.confirm_sign_up( ClientId=client_id, Username=username, ConfirmationCode="123456", ) @@ -2097,7 +2089,7 @@ def test_initiate_auth_with_invalid_secret_hash(): caught = False try: - result = conn.initiate_auth( + conn.initiate_auth( ClientId=client_id, AuthFlow="USER_SRP_AUTH", AuthParameters={ diff --git a/tests/test_config/test_config.py b/tests/test_config/test_config.py index 41774c2fa..eadca514f 100644 --- a/tests/test_config/test_config.py +++ b/tests/test_config/test_config.py @@ -12,7 +12,7 @@ from moto import mock_s3 from moto.config import mock_config from moto.core import ACCOUNT_ID -import sure # noqa +import sure # noqa # pylint: disable=unused-import @mock_config @@ -1973,11 +1973,11 @@ def test_describe_organization_conformance_packs_errors(): def test_describe_organization_conformance_pack_statuses(): # given client = boto3.client("config", region_name="us-east-1") - arn = client.put_organization_conformance_pack( + client.put_organization_conformance_pack( DeliveryS3Bucket="awsconfigconforms-test-bucket", OrganizationConformancePackName="test-pack", TemplateS3Uri="s3://test-bucket/test-pack.yaml", - )["OrganizationConformancePackArn"] + ) # when response = client.describe_organization_conformance_pack_statuses( @@ -2121,14 +2121,14 @@ def test_get_organization_conformance_pack_detailed_status_errors(): def test_delete_organization_conformance_pack(): # given client = boto3.client("config", region_name="us-east-1") - arn = client.put_organization_conformance_pack( + client.put_organization_conformance_pack( DeliveryS3Bucket="awsconfigconforms-test-bucket", OrganizationConformancePackName="test-pack", TemplateS3Uri="s3://test-bucket/test-pack.yaml", - )["OrganizationConformancePackArn"] + ) # when - response = client.delete_organization_conformance_pack( + client.delete_organization_conformance_pack( OrganizationConformancePackName="test-pack" ) diff --git a/tests/test_core/test_auth.py b/tests/test_core/test_auth.py index b6fc8a135..e27e8faf1 100644 --- a/tests/test_core/test_auth.py +++ b/tests/test_core/test_auth.py @@ -1,7 +1,7 @@ import json import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest diff --git a/tests/test_core/test_context_manager.py b/tests/test_core/test_context_manager.py index d20c2187f..077e6c44f 100644 --- a/tests/test_core/test_context_manager.py +++ b/tests/test_core/test_context_manager.py @@ -1,4 +1,4 @@ -import sure # noqa +import sure # noqa # pylint: disable=unused-import import boto3 from moto import mock_sqs, settings diff --git a/tests/test_core/test_decorator_calls.py b/tests/test_core/test_decorator_calls.py index 3da37b6bc..ad0109ef2 100644 --- a/tests/test_core/test_decorator_calls.py +++ b/tests/test_core/test_decorator_calls.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto from boto.exception import EC2ResponseError -import sure # noqa +import sure # noqa # pylint: disable=unused-import import unittest import pytest diff --git a/tests/test_core/test_environ_patching.py b/tests/test_core/test_environ_patching.py index d4e15c78a..4678b9f14 100644 --- a/tests/test_core/test_environ_patching.py +++ b/tests/test_core/test_environ_patching.py @@ -1,5 +1,5 @@ import os -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_s3 KEY = "AWS_ACCESS_KEY_ID" diff --git a/tests/test_core/test_instance_metadata.py b/tests/test_core/test_instance_metadata.py index 9870f0df5..f928cd914 100644 --- a/tests/test_core/test_instance_metadata.py +++ b/tests/test_core/test_instance_metadata.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa -import pytest +import sure # noqa # pylint: disable=unused-import import requests from moto import mock_ec2, settings diff --git a/tests/test_core/test_moto_api.py b/tests/test_core/test_moto_api.py index 648510475..d1fa77b20 100644 --- a/tests/test_core/test_moto_api.py +++ b/tests/test_core/test_moto_api.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa -import pytest +import sure # noqa # pylint: disable=unused-import import requests import boto3 diff --git a/tests/test_core/test_nested.py b/tests/test_core/test_nested.py index ebe33212d..f061ea8f6 100644 --- a/tests/test_core/test_nested.py +++ b/tests/test_core/test_nested.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import unittest from boto.sqs.connection import SQSConnection diff --git a/tests/test_core/test_request_mocking.py b/tests/test_core/test_request_mocking.py index e08b664b6..a68f95f22 100644 --- a/tests/test_core/test_request_mocking.py +++ b/tests/test_core/test_request_mocking.py @@ -1,6 +1,6 @@ import requests import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import boto3 from moto import mock_s3, mock_sts, mock_sqs, settings diff --git a/tests/test_core/test_responses.py b/tests/test_core/test_responses.py index 2e4b8e300..f454350ea 100644 --- a/tests/test_core/test_responses.py +++ b/tests/test_core/test_responses.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import from collections import OrderedDict diff --git a/tests/test_core/test_server.py b/tests/test_core/test_server.py index d25270700..d3715c6cf 100644 --- a/tests/test_core/test_server.py +++ b/tests/test_core/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import from unittest.mock import patch from moto.server import main, create_backend_app, DomainDispatcherApplication diff --git a/tests/test_core/test_url_mapping.py b/tests/test_core/test_url_mapping.py index 9d0632e05..e947da925 100644 --- a/tests/test_core/test_url_mapping.py +++ b/tests/test_core/test_url_mapping.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.core.utils import convert_regex_to_flask_path diff --git a/tests/test_core/test_utils.py b/tests/test_core/test_utils.py index f404f52a5..ec86564be 100644 --- a/tests/test_core/test_utils.py +++ b/tests/test_core/test_utils.py @@ -1,24 +1,18 @@ -from __future__ import unicode_literals - -import copy -import sys - import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from freezegun import freeze_time from moto.core.utils import ( camelcase_to_underscores, underscores_to_camelcase, unix_time, - py2_strip_unicode_keys, camelcase_to_pascal, pascal_to_camelcase, ) @pytest.mark.parametrize( - "input,expected", + "_input,expected", [ ("theNewAttribute", "the_new_attribute"), ("attri bute With Space", "attribute_with_space"), @@ -26,32 +20,32 @@ from moto.core.utils import ( ("ListMFADevices", "list_mfa_devices"), ], ) -def test_camelcase_to_underscores(input, expected): - camelcase_to_underscores(input).should.equal(expected) +def test_camelcase_to_underscores(_input, expected): + camelcase_to_underscores(_input).should.equal(expected) @pytest.mark.parametrize( - "input,expected", + "_input,expected", [("the_new_attribute", "theNewAttribute"), ("attribute", "attribute"),], ) -def test_underscores_to_camelcase(input, expected): - underscores_to_camelcase(input).should.equal(expected) +def test_underscores_to_camelcase(_input, expected): + underscores_to_camelcase(_input).should.equal(expected) @pytest.mark.parametrize( - "input,expected", + "_input,expected", [("TheNewAttribute", "theNewAttribute"), ("Attribute", "attribute"),], ) -def test_pascal_to_camelcase(input, expected): - pascal_to_camelcase(input).should.equal(expected) +def test_pascal_to_camelcase(_input, expected): + pascal_to_camelcase(_input).should.equal(expected) @pytest.mark.parametrize( - "input,expected", + "_input,expected", [("theNewAttribute", "TheNewAttribute"), ("attribute", "Attribute"),], ) -def test_camelcase_to_pascal(input, expected): - camelcase_to_pascal(input).should.equal(expected) +def test_camelcase_to_pascal(_input, expected): + camelcase_to_pascal(_input).should.equal(expected) @freeze_time("2015-01-01 12:00:00") diff --git a/tests/test_datapipeline/test_datapipeline.py b/tests/test_datapipeline/test_datapipeline.py index 3b1d2a850..60f8edf95 100644 --- a/tests/test_datapipeline/test_datapipeline.py +++ b/tests/test_datapipeline/test_datapipeline.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto.datapipeline +import sure # noqa # pylint: disable=unused-import import boto3 -import sure # noqa from moto import mock_datapipeline from moto import mock_datapipeline_deprecated diff --git a/tests/test_datapipeline/test_datapipeline_cloudformation.py b/tests/test_datapipeline/test_datapipeline_cloudformation.py index 68f8e7d3c..f8a9bcd5d 100644 --- a/tests/test_datapipeline/test_datapipeline_cloudformation.py +++ b/tests/test_datapipeline/test_datapipeline_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudformation, mock_datapipeline diff --git a/tests/test_datapipeline/test_server.py b/tests/test_datapipeline/test_server.py index 49b8c39ce..e5883a36f 100644 --- a/tests/test_datapipeline/test_server.py +++ b/tests/test_datapipeline/test_server.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_datapipeline diff --git a/tests/test_datasync/test_datasync.py b/tests/test_datasync/test_datasync.py index 1d7b4e17b..2e1ecdfc3 100644 --- a/tests/test_datasync/test_datasync.py +++ b/tests/test_datasync/test_datasync.py @@ -1,10 +1,8 @@ -import logging - -import boto import boto3 from botocore.exceptions import ClientError from moto import mock_datasync import pytest +import sure # noqa # pylint: disable=unused-import def create_locations(client, create_smb=False, create_s3=False): @@ -102,7 +100,10 @@ def test_describe_location_wrong(): AgentArns=agent_arns, ) with pytest.raises(ClientError) as e: - response = client.describe_location_s3(LocationArn=response["LocationArn"]) + client.describe_location_s3(LocationArn=response["LocationArn"]) + err = e.value.response["Error"] + err["Code"].should.equal("InvalidRequestException") + err["Message"].should.equal("Invalid Location type: SMB") @mock_datasync @@ -135,12 +136,12 @@ def test_delete_location(): assert len(response["Locations"]) == 1 location_arn = locations["smb_arn"] - response = client.delete_location(LocationArn=location_arn) + client.delete_location(LocationArn=location_arn) response = client.list_locations() assert len(response["Locations"]) == 0 with pytest.raises(ClientError): - response = client.delete_location(LocationArn=location_arn) + client.delete_location(LocationArn=location_arn) @mock_datasync @@ -160,13 +161,20 @@ def test_create_task_fail(): client = boto3.client("datasync", region_name="us-east-1") locations = create_locations(client, create_smb=True, create_s3=True) with pytest.raises(ClientError) as e: - response = client.create_task( + client.create_task( SourceLocationArn="1", DestinationLocationArn=locations["s3_arn"] ) + err = e.value.response["Error"] + err["Code"].should.equal("InvalidRequestException") + err["Message"].should.equal("Location 1 not found.") + with pytest.raises(ClientError) as e: - response = client.create_task( + client.create_task( SourceLocationArn=locations["smb_arn"], DestinationLocationArn="2" ) + err = e.value.response["Error"] + err["Code"].should.equal("InvalidRequestException") + err["Message"].should.equal("Location 2 not found.") @mock_datasync @@ -174,11 +182,11 @@ def test_list_tasks(): client = boto3.client("datasync", region_name="us-east-1") locations = create_locations(client, create_s3=True, create_smb=True) - response = client.create_task( + client.create_task( SourceLocationArn=locations["smb_arn"], DestinationLocationArn=locations["s3_arn"], ) - response = client.create_task( + client.create_task( SourceLocationArn=locations["s3_arn"], DestinationLocationArn=locations["smb_arn"], Name="task_name", @@ -222,6 +230,9 @@ def test_describe_task_not_exist(): with pytest.raises(ClientError) as e: client.describe_task(TaskArn="abc") + err = e.value.response["Error"] + err["Code"].should.equal("InvalidRequestException") + err["Message"].should.equal("The request is not valid.") @mock_datasync @@ -253,9 +264,7 @@ def test_update_task(): assert response["Name"] == initial_name assert response["Options"] == initial_options - response = client.update_task( - TaskArn=task_arn, Name=updated_name, Options=updated_options - ) + client.update_task(TaskArn=task_arn, Name=updated_name, Options=updated_options) response = client.describe_task(TaskArn=task_arn) assert response["TaskArn"] == task_arn @@ -271,7 +280,7 @@ def test_delete_task(): client = boto3.client("datasync", region_name="us-east-1") locations = create_locations(client, create_s3=True, create_smb=True) - response = client.create_task( + client.create_task( SourceLocationArn=locations["smb_arn"], DestinationLocationArn=locations["s3_arn"], Name="task_name", @@ -282,12 +291,12 @@ def test_delete_task(): task_arn = response["Tasks"][0]["TaskArn"] assert task_arn is not None - response = client.delete_task(TaskArn=task_arn) + client.delete_task(TaskArn=task_arn) response = client.list_tasks() assert len(response["Tasks"]) == 0 with pytest.raises(ClientError): - response = client.delete_task(TaskArn=task_arn) + client.delete_task(TaskArn=task_arn) @mock_datasync @@ -326,10 +335,10 @@ def test_start_task_execution_twice(): response = client.start_task_execution(TaskArn=task_arn) assert "TaskExecutionArn" in response - task_execution_arn = response["TaskExecutionArn"] + response["TaskExecutionArn"] - with pytest.raises(ClientError) as e: - response = client.start_task_execution(TaskArn=task_arn) + with pytest.raises(ClientError): + client.start_task_execution(TaskArn=task_arn) @mock_datasync @@ -394,6 +403,9 @@ def test_describe_task_execution_not_exist(): with pytest.raises(ClientError) as e: client.describe_task_execution(TaskExecutionArn="abc") + err = e.value.response["Error"] + err["Code"].should.equal("InvalidRequestException") + err["Message"].should.equal("The request is not valid.") @mock_datasync @@ -415,7 +427,7 @@ def test_cancel_task_execution(): assert response["CurrentTaskExecutionArn"] == task_execution_arn assert response["Status"] == "RUNNING" - response = client.cancel_task_execution(TaskExecutionArn=task_execution_arn) + client.cancel_task_execution(TaskExecutionArn=task_execution_arn) response = client.describe_task(TaskArn=task_arn) assert "CurrentTaskExecutionArn" not in response diff --git a/tests/test_dms/test_dms.py b/tests/test_dms/test_dms.py index bbbf2125a..04ad2efaa 100644 --- a/tests/test_dms/test_dms.py +++ b/tests/test_dms/test_dms.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - from botocore.exceptions import ClientError import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from moto import mock_dms diff --git a/tests/test_dynamodb/test_dynamodb.py b/tests/test_dynamodb/test_dynamodb.py index 4b89c0bae..2f0874689 100644 --- a/tests/test_dynamodb/test_dynamodb.py +++ b/tests/test_dynamodb/test_dynamodb.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals import boto import boto.dynamodb -import sure # noqa -import requests +import sure # noqa # pylint: disable=unused-import import pytest -from moto import mock_dynamodb, mock_dynamodb_deprecated +from moto import mock_dynamodb_deprecated from moto.dynamodb import dynamodb_backend from boto.exception import DynamoDBResponseError diff --git a/tests/test_dynamodb/test_dynamodb_table_with_range_key.py b/tests/test_dynamodb/test_dynamodb_table_with_range_key.py index 904731525..64d626471 100644 --- a/tests/test_dynamodb/test_dynamodb_table_with_range_key.py +++ b/tests/test_dynamodb/test_dynamodb_table_with_range_key.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from freezegun import freeze_time from moto import mock_dynamodb_deprecated diff --git a/tests/test_dynamodb/test_dynamodb_table_without_range_key.py b/tests/test_dynamodb/test_dynamodb_table_without_range_key.py index f0baa7c9d..336a11682 100644 --- a/tests/test_dynamodb/test_dynamodb_table_without_range_key.py +++ b/tests/test_dynamodb/test_dynamodb_table_without_range_key.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from freezegun import freeze_time from moto import mock_dynamodb_deprecated diff --git a/tests/test_dynamodb/test_server.py b/tests/test_dynamodb/test_server.py index 2f039bc03..a0b5f1654 100644 --- a/tests/test_dynamodb/test_server.py +++ b/tests/test_dynamodb/test_server.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import json +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_dynamodb import moto.server as server diff --git a/tests/test_dynamodb2/test_dynamodb.py b/tests/test_dynamodb2/test_dynamodb.py index ae2873a25..e396a7ef0 100644 --- a/tests/test_dynamodb2/test_dynamodb.py +++ b/tests/test_dynamodb2/test_dynamodb.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals, print_function +from __future__ import print_function import uuid from datetime import datetime @@ -8,7 +8,7 @@ import boto import boto3 from boto3.dynamodb.conditions import Attr, Key import re -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_dynamodb2, mock_dynamodb2_deprecated from moto.dynamodb2 import dynamodb_backend2, dynamodb_backends2 from boto.exception import JSONResponseError @@ -189,9 +189,6 @@ def test_list_table_tags_empty(): ) table_description = conn.describe_table(TableName=name) arn = table_description["Table"]["TableArn"] - tags = [{"Key": "TestTag", "Value": "TestValue"}] - # conn.tag_resource(ResourceArn=arn, - # Tags=tags) resp = conn.list_tags_of_resource(ResourceArn=arn) assert resp["Tags"] == [] @@ -2064,6 +2061,9 @@ def test_delete_item(): table.delete_item( Key={"client": "client1", "app": "app1"}, ReturnValues="ALL_NEW" ) + err = ex.value.response["Error"] + err["Code"].should.equal("ValidationException") + err["Message"].should.equal("Return values set to invalid value") # Test deletion and returning old value response = table.delete_item( @@ -2514,7 +2514,10 @@ def test_update_return_attributes(): assert r["Attributes"] == {} with pytest.raises(ClientError) as ex: - r = update("col1", "val6", "WRONG") + update("col1", "val6", "WRONG") + err = ex.value.response["Error"] + err["Code"].should.equal("ValidationException") + err["Message"].should.equal("Return values set to invalid value") # https://github.com/spulec/moto/issues/3448 @@ -2552,7 +2555,10 @@ def test_update_return_updated_new_attributes_when_same(): assert r["Attributes"] == {"listValuedAttribute1": {1, 2}} with pytest.raises(ClientError) as ex: - r = update("a", ["a", "c"], "WRONG") + update("a", ["a", "c"], "WRONG") + err = ex.value.response["Error"] + err["Code"].should.equal("ValidationException") + err["Message"].should.equal("Return values set to invalid value") @mock_dynamodb2 @@ -3212,9 +3218,7 @@ def test_update_list_index__set_index_of_a_string(): UpdateExpression="set itemstr[1]=:Item", ExpressionAttributeValues={":Item": {"S": "string_update"}}, ) - result = client.get_item(TableName=table_name, Key={"id": {"S": "foo2"}})[ - "Item" - ] + client.get_item(TableName=table_name, Key={"id": {"S": "foo2"}})["Item"] ex.value.response["Error"]["Code"].should.equal("ValidationException") ex.value.response["Error"]["Message"].should.equal( @@ -5618,7 +5622,7 @@ def test_create_multiple_backups_with_same_name(): ) backup_name = "backup-test-table" backup_arns = [] - for i in range(4): + for _ in range(4): backup = client.create_backup(TableName=table_name, BackupName=backup_name).get( "BackupDetails" ) @@ -5832,7 +5836,7 @@ def test_source_and_restored_table_items_are_not_linked(): def add_guids_to_table(table, num_items): guids = [] - for i in range(num_items): + for _ in range(num_items): guid = str(uuid.uuid4()) client.put_item(TableName=table, Item={"id": {"S": guid}}) guids.append(guid) diff --git a/tests/test_dynamodb2/test_dynamodb_cloudformation.py b/tests/test_dynamodb2/test_dynamodb_cloudformation.py index bed5005c7..a953151a9 100644 --- a/tests/test_dynamodb2/test_dynamodb_cloudformation.py +++ b/tests/test_dynamodb2/test_dynamodb_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudformation, mock_dynamodb2 diff --git a/tests/test_dynamodb2/test_dynamodb_condition_expressions.py b/tests/test_dynamodb2/test_dynamodb_condition_expressions.py index 108c04dae..6826180a7 100644 --- a/tests/test_dynamodb2/test_dynamodb_condition_expressions.py +++ b/tests/test_dynamodb2/test_dynamodb_condition_expressions.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from decimal import Decimal from moto import mock_dynamodb2 diff --git a/tests/test_dynamodb2/test_dynamodb_consumedcapacity.py b/tests/test_dynamodb2/test_dynamodb_consumedcapacity.py index 03e8d0249..a284b9a64 100644 --- a/tests/test_dynamodb2/test_dynamodb_consumedcapacity.py +++ b/tests/test_dynamodb2/test_dynamodb_consumedcapacity.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_dynamodb2 diff --git a/tests/test_dynamodb2/test_dynamodb_exceptions.py b/tests/test_dynamodb2/test_dynamodb_exceptions.py index 427c8d325..8ba9af772 100644 --- a/tests/test_dynamodb2/test_dynamodb_exceptions.py +++ b/tests/test_dynamodb2/test_dynamodb_exceptions.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_dynamodb2 diff --git a/tests/test_dynamodb2/test_dynamodb_table_with_range_key.py b/tests/test_dynamodb2/test_dynamodb_table_with_range_key.py index 1f93695c5..50b493841 100644 --- a/tests/test_dynamodb2/test_dynamodb_table_with_range_key.py +++ b/tests/test_dynamodb2/test_dynamodb_table_with_range_key.py @@ -1,13 +1,11 @@ -from __future__ import unicode_literals - from decimal import Decimal import boto import boto3 from boto3.dynamodb.conditions import Key from botocore.exceptions import ClientError +import sure # noqa # pylint: disable=unused-import from datetime import datetime -import sure # noqa from freezegun import freeze_time import pytest @@ -54,7 +52,7 @@ def create_table_with_local_indexes(): def iterate_results(res): - for i in res: + for _ in res: pass @@ -1059,7 +1057,7 @@ def test_query_non_hash_range_key(): # Has boto3 equivalent @mock_dynamodb2_deprecated def test_reverse_query(): - conn = boto.dynamodb2.layer1.DynamoDBConnection() + boto.dynamodb2.layer1.DynamoDBConnection() table = Table.create( "messages", schema=[HashKey("subject"), RangeKey("created_at", data_type="N")] @@ -1077,8 +1075,6 @@ def test_reverse_query(): # Has boto3 equivalent @mock_dynamodb2_deprecated def test_lookup(): - from decimal import Decimal - table = Table.create( "messages", schema=[HashKey("test_hash"), RangeKey("test_range")], @@ -1406,7 +1402,7 @@ def _create_table_with_range_key(): dynamodb = boto3.resource("dynamodb", region_name="us-east-1") # Create the DynamoDB table. - table = dynamodb.create_table( + dynamodb.create_table( TableName="users", KeySchema=[ {"AttributeName": "forum_name", "KeyType": "HASH"}, diff --git a/tests/test_dynamodb2/test_dynamodb_table_without_range_key.py b/tests/test_dynamodb2/test_dynamodb_table_without_range_key.py index bb7e51306..841d63a9d 100644 --- a/tests/test_dynamodb2/test_dynamodb_table_without_range_key.py +++ b/tests/test_dynamodb2/test_dynamodb_table_without_range_key.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import boto import boto3 from boto3.dynamodb.conditions import Key +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from datetime import datetime from freezegun import freeze_time from boto.exception import JSONResponseError @@ -852,7 +850,7 @@ def test_boto3_create_table(): def _create_user_table(): dynamodb = boto3.resource("dynamodb", region_name="us-east-1") - table = dynamodb.create_table( + dynamodb.create_table( TableName="users", KeySchema=[{"AttributeName": "username", "KeyType": "HASH"}], AttributeDefinitions=[{"AttributeName": "username", "AttributeType": "S"}], diff --git a/tests/test_dynamodb2/test_dynamodb_validation.py b/tests/test_dynamodb2/test_dynamodb_validation.py index eb33ae5c9..b81441372 100644 --- a/tests/test_dynamodb2/test_dynamodb_validation.py +++ b/tests/test_dynamodb2/test_dynamodb_validation.py @@ -7,7 +7,6 @@ from moto.dynamodb2.exceptions import ( ExpressionAttributeNameNotDefined, IncorrectOperandType, InvalidUpdateExpressionInvalidDocumentPath, - EmptyKeyAttributeException, ) from moto.dynamodb2.models import Item, DynamoType from moto.dynamodb2.parsing.ast_nodes import ( diff --git a/tests/test_dynamodb2/test_server.py b/tests/test_dynamodb2/test_server.py index b2d348ab5..1e461c466 100644 --- a/tests/test_dynamodb2/test_server.py +++ b/tests/test_dynamodb2/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_dynamodbstreams/test_dynamodbstreams.py b/tests/test_dynamodbstreams/test_dynamodbstreams.py index 8982617ae..bb18d1d8c 100644 --- a/tests/test_dynamodbstreams/test_dynamodbstreams.py +++ b/tests/test_dynamodbstreams/test_dynamodbstreams.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals, print_function +from __future__ import print_function import pytest diff --git a/tests/test_ec2/test_account_attributes.py b/tests/test_ec2/test_account_attributes.py index 41c71def5..83158c1a3 100644 --- a/tests/test_ec2/test_account_attributes.py +++ b/tests/test_ec2/test_account_attributes.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto3 from moto import mock_ec2 -import sure # noqa +import sure # pylint: disable=unused-import @mock_ec2 diff --git a/tests/test_ec2/test_amazon_dev_pay.py b/tests/test_ec2/test_amazon_dev_pay.py index 1dd9cc74e..9aeed671d 100644 --- a/tests/test_ec2/test_amazon_dev_pay.py +++ b/tests/test_ec2/test_amazon_dev_pay.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_amis.py b/tests/test_ec2/test_amis.py index 520177c91..525e23f45 100644 --- a/tests/test_ec2/test_amis.py +++ b/tests/test_ec2/test_amis.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import boto import boto.ec2 import boto3 @@ -7,8 +5,8 @@ from boto.exception import EC2ResponseError from botocore.exceptions import ClientError import pytest +import sure # noqa # pylint: disable=unused-import import random -import sure # noqa from moto import mock_ec2_deprecated, mock_ec2 from moto.ec2.models import AMIS, OWNER_ID @@ -31,9 +29,7 @@ def test_ami_create_and_delete(): instance = reservation.instances[0] with pytest.raises(EC2ResponseError) as ex: - image_id = conn.create_image( - instance.id, "test-ami", "this is a test ami", dry_run=True - ) + conn.create_image(instance.id, "test-ami", "this is a test ami", dry_run=True) ex.value.error_code.should.equal("DryRunOperation") ex.value.status.should.equal(412) ex.value.message.should.equal( @@ -142,7 +138,6 @@ def test_ami_create_and_delete_boto3(): set([i["ImageId"] for i in all_images]).should.contain(image_id) retrieved_image = [i for i in all_images if i["ImageId"] == image_id][0] - created_snapshot_id = retrieved_image["BlockDeviceMappings"][0]["Ebs"]["SnapshotId"] retrieved_image.should.have.key("ImageId").equal(image_id) retrieved_image.should.have.key("VirtualizationType").equal( diff --git a/tests/test_ec2/test_availability_zones_and_regions.py b/tests/test_ec2/test_availability_zones_and_regions.py index 535a5f70d..f158e4b3e 100644 --- a/tests/test_ec2/test_availability_zones_and_regions.py +++ b/tests/test_ec2/test_availability_zones_and_regions.py @@ -1,9 +1,8 @@ -from __future__ import unicode_literals import boto import boto.ec2 import boto3 +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from botocore.exceptions import ClientError from moto import mock_ec2, mock_ec2_deprecated diff --git a/tests/test_ec2/test_carrier_gateways.py b/tests/test_ec2/test_carrier_gateways.py index f41e54b0e..aadda048f 100644 --- a/tests/test_ec2/test_carrier_gateways.py +++ b/tests/test_ec2/test_carrier_gateways.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from botocore.exceptions import ClientError from moto import mock_ec2, settings diff --git a/tests/test_ec2/test_customer_gateways.py b/tests/test_ec2/test_customer_gateways.py index a30df3543..5c32f6f17 100644 --- a/tests/test_ec2/test_customer_gateways.py +++ b/tests/test_ec2/test_customer_gateways.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto +import sure # noqa # pylint: disable=unused-import import boto3 -import sure # noqa import pytest from boto.exception import EC2ResponseError from botocore.exceptions import ClientError @@ -91,7 +90,7 @@ def test_delete_customer_gateways(): customer_gateway.should_not.be.none cgws = conn.get_all_customer_gateways() cgws[0].id.should.match(customer_gateway.id) - deleted = conn.delete_customer_gateway(customer_gateway.id) + conn.delete_customer_gateway(customer_gateway.id) cgws = conn.get_all_customer_gateways() cgws[0].state.should.equal("deleted") cgws.should.have.length_of(1) @@ -123,7 +122,7 @@ def test_delete_customer_gateways_boto3(): @mock_ec2_deprecated def test_delete_customer_gateways_bad_id(): conn = boto.connect_vpc("the_key", "the_secret") - with pytest.raises(EC2ResponseError) as cm: + with pytest.raises(EC2ResponseError): conn.delete_customer_gateway("cgw-0123abcd") diff --git a/tests/test_ec2/test_dhcp_options.py b/tests/test_ec2/test_dhcp_options.py index 8890de178..673224be7 100644 --- a/tests/test_ec2/test_dhcp_options.py +++ b/tests/test_ec2/test_dhcp_options.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import pytest import boto3 @@ -7,7 +5,7 @@ import boto from boto.exception import EC2ResponseError from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import import random import uuid diff --git a/tests/test_ec2/test_ec2_cloudformation.py b/tests/test_ec2/test_ec2_cloudformation.py index 483e005c0..afaec395f 100644 --- a/tests/test_ec2/test_ec2_cloudformation.py +++ b/tests/test_ec2/test_ec2_cloudformation.py @@ -14,8 +14,8 @@ import boto.cloudformation import boto.vpc import boto3 import json +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa template_vpc = { diff --git a/tests/test_ec2/test_ec2_core.py b/tests/test_ec2/test_ec2_core.py index 78b780d97..e69de29bb 100644 --- a/tests/test_ec2/test_ec2_core.py +++ b/tests/test_ec2/test_ec2_core.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_ec2/test_ec2_integration.py b/tests/test_ec2/test_ec2_integration.py index 5a7fb99c4..eb6958af5 100644 --- a/tests/test_ec2/test_ec2_integration.py +++ b/tests/test_ec2/test_ec2_integration.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # pylint: disable=unused-import from moto import mock_ec2, mock_kms from tests import EXAMPLE_AMI_ID diff --git a/tests/test_ec2/test_egress_only_igw.py b/tests/test_ec2/test_egress_only_igw.py index 491ed15ef..62aa83cae 100644 --- a/tests/test_ec2/test_egress_only_igw.py +++ b/tests/test_ec2/test_egress_only_igw.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_ec2 diff --git a/tests/test_ec2/test_elastic_block_store.py b/tests/test_ec2/test_elastic_block_store.py index 8baf0e86d..926722bbb 100644 --- a/tests/test_ec2/test_elastic_block_store.py +++ b/tests/test_ec2/test_elastic_block_store.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals - import boto import boto.ec2 import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto.exception import EC2ResponseError from botocore.exceptions import ClientError from moto import mock_ec2, mock_ec2_deprecated @@ -686,8 +684,6 @@ def test_create_snapshot_boto3(): snapshots[0]["Encrypted"].should.be(False) # Create snapshot without description - num_snapshots = len(client.describe_snapshots()["Snapshots"]) - snapshot = volume.create_snapshot() current_snapshots = client.describe_snapshots()["Snapshots"] [s["SnapshotId"] for s in current_snapshots].should.contain(snapshot.id) @@ -748,7 +744,7 @@ def test_create_encrypted_snapshot_boto3(encrypted): def test_filter_snapshot_by_id(): conn = boto.ec2.connect_to_region("us-east-1") volume1 = conn.create_volume(36, "us-east-1a") - snap1 = volume1.create_snapshot("a test snapshot 1") + volume1.create_snapshot("a test snapshot 1") volume2 = conn.create_volume(42, "us-east-1a") snap2 = volume2.create_snapshot("a test snapshot 2") volume3 = conn.create_volume(84, "us-east-1a") @@ -937,8 +933,6 @@ def test_snapshot_filters_boto3(): # Has boto3 equivalent @mock_ec2_deprecated def test_snapshot_attribute(): - import copy - conn = boto.ec2.connect_to_region("us-east-1") volume = conn.create_volume(80, "us-east-1a") snapshot = volume.create_snapshot() @@ -1047,8 +1041,6 @@ def test_snapshot_attribute(): @mock_ec2 def test_modify_snapshot_attribute(): - import copy - ec2_client = boto3.client("ec2", region_name="us-east-1") response = ec2_client.create_volume(Size=80, AvailabilityZone="us-east-1a") volume = boto3.resource("ec2", region_name="us-east-1").Volume(response["VolumeId"]) @@ -1102,7 +1094,7 @@ def test_modify_snapshot_attribute(): ], "This snapshot should have public group permissions." # Remove 'all' group and confirm - with pytest.raises(ClientError) as ex: + with pytest.raises(ClientError): ec2_client.modify_snapshot_attribute( **dict(REMOVE_GROUP_ARGS, **{"DryRun": True}) ) @@ -1448,24 +1440,24 @@ def test_copy_snapshot(): # Copy from non-existent source ID. with pytest.raises(ClientError) as cm: - create_snapshot_error = ec2_client.create_snapshot(VolumeId="vol-abcd1234") - cm.value.response["Error"]["Code"].should.equal("InvalidVolume.NotFound") - cm.value.response["Error"]["Message"].should.equal( - "The volume 'vol-abcd1234' does not exist." - ) - cm.value.response["ResponseMetadata"]["RequestId"].should_not.be.none - cm.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) + ec2_client.create_snapshot(VolumeId="vol-abcd1234") + cm.value.response["Error"]["Code"].should.equal("InvalidVolume.NotFound") + cm.value.response["Error"]["Message"].should.equal( + "The volume 'vol-abcd1234' does not exist." + ) + cm.value.response["ResponseMetadata"]["RequestId"].should_not.be.none + cm.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) # Copy from non-existent source region. with pytest.raises(ClientError) as cm: - copy_snapshot_response = dest_ec2_client.copy_snapshot( + dest_ec2_client.copy_snapshot( SourceSnapshotId=create_snapshot_response["SnapshotId"], SourceRegion="eu-west-2", ) - cm.value.response["Error"]["Code"].should.equal("InvalidSnapshot.NotFound") - cm.value.response["Error"]["Message"].should.be.none - cm.value.response["ResponseMetadata"]["RequestId"].should_not.be.none - cm.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) + cm.value.response["Error"]["Code"].should.equal("InvalidSnapshot.NotFound") + cm.value.response["Error"]["Message"].should.be.none + cm.value.response["ResponseMetadata"]["RequestId"].should_not.be.none + cm.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @mock_ec2 @@ -1475,7 +1467,7 @@ def test_search_for_many_snapshots(): volume_response = ec2_client.create_volume(AvailabilityZone="eu-west-1a", Size=10) snapshot_ids = [] - for i in range(1, 20): + for _ in range(1, 20): create_snapshot_response = ec2_client.create_snapshot( VolumeId=volume_response["VolumeId"] ) diff --git a/tests/test_ec2/test_elastic_ip_addresses.py b/tests/test_ec2/test_elastic_ip_addresses.py index ed4238625..364455f11 100644 --- a/tests/test_ec2/test_elastic_ip_addresses.py +++ b/tests/test_ec2/test_elastic_ip_addresses.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import pytest import boto @@ -8,7 +6,7 @@ from boto.exception import EC2ResponseError from botocore.exceptions import ClientError from uuid import uuid4 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_ec2_deprecated from tests import EXAMPLE_AMI_ID @@ -156,7 +154,6 @@ def test_eip_allocate_vpc_boto3(): @mock_ec2 def test_specific_eip_allocate_vpc(): """Allocate VPC EIP with specific address""" - service = boto3.resource("ec2", region_name="us-west-1") client = boto3.client("ec2", region_name="us-west-1") vpc = client.allocate_address(Domain="vpc", Address="127.38.43.222") @@ -653,7 +650,7 @@ def test_eip_associate_invalid_args(): reservation = conn.run_instances(EXAMPLE_AMI_ID) instance = reservation.instances[0] - eip = conn.allocate_address() + conn.allocate_address() with pytest.raises(EC2ResponseError) as cm: conn.associate_address(instance_id=instance.id) @@ -1010,7 +1007,7 @@ def test_eip_tags(): # Allocate one address and add tags alloc_tags = client.allocate_address(Domain="vpc") managed_by = str(uuid4()) - with_tags = client.create_tags( + client.create_tags( Resources=[alloc_tags["AllocationId"]], Tags=[{"Key": "ManagedBy", "Value": managed_by}], ) diff --git a/tests/test_ec2/test_elastic_network_interfaces.py b/tests/test_ec2/test_elastic_network_interfaces.py index d28201f21..d5dc03244 100644 --- a/tests/test_ec2/test_elastic_network_interfaces.py +++ b/tests/test_ec2/test_elastic_network_interfaces.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import pytest import random @@ -8,7 +6,7 @@ from botocore.exceptions import ClientError import boto import boto.ec2 from boto.exception import EC2ResponseError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_ec2_deprecated, settings from tests.helpers import requires_boto_gte diff --git a/tests/test_ec2/test_flow_logs.py b/tests/test_ec2/test_flow_logs.py index 5debda70b..f3f82a10b 100644 --- a/tests/test_ec2/test_flow_logs.py +++ b/tests/test_ec2/test_flow_logs.py @@ -1,12 +1,10 @@ -from __future__ import unicode_literals - import pytest import boto3 from botocore.exceptions import ClientError from botocore.parsers import ResponseParserError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import ( settings, @@ -265,7 +263,6 @@ def test_delete_flow_logs_non_existing(): @mock_ec2 def test_create_flow_logs_unsuccessful(): - s3 = boto3.resource("s3", region_name="us-west-1") client = boto3.client("ec2", region_name="us-west-1") vpc1 = client.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"] @@ -581,7 +578,6 @@ def test_describe_flow_logs_filtering(): @mock_s3 @mock_ec2 def test_flow_logs_by_ids(): - s3 = boto3.resource("s3", region_name="us-west-1") client = boto3.client("ec2", region_name="us-west-1") vpc1 = client.create_vpc(CidrBlock="10.0.0.0/16")["Vpc"] @@ -642,7 +638,7 @@ def test_flow_logs_by_ids(): all_ids.shouldnt.contain(fl3) -def retrieve_all_logs(client, filters=[]): +def retrieve_all_logs(client, filters=[]): # pylint: disable=W0102 resp = client.describe_flow_logs(Filters=filters) all_logs = resp["FlowLogs"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_flow_logs_cloudformation.py b/tests/test_ec2/test_flow_logs_cloudformation.py index af69a6f1c..ecd32a23a 100644 --- a/tests/test_ec2/test_flow_logs_cloudformation.py +++ b/tests/test_ec2/test_flow_logs_cloudformation.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import ( mock_cloudformation, @@ -50,10 +48,9 @@ def test_flow_logs_by_cloudformation(): }, } flow_log_template_json = json.dumps(flow_log_template) + stack_name = str(uuid4()) - stack_id = cf_client.create_stack( - StackName=stack_name, TemplateBody=flow_log_template_json - )["StackId"] + cf_client.create_stack(StackName=stack_name, TemplateBody=flow_log_template_json) flow_logs = client.describe_flow_logs( Filters=[{"Name": "resource-id", "Values": [vpc["VpcId"]]}] diff --git a/tests/test_ec2/test_general.py b/tests/test_ec2/test_general.py index f09025e04..4a216d6fb 100644 --- a/tests/test_ec2/test_general.py +++ b/tests/test_ec2/test_general.py @@ -1,12 +1,9 @@ -from __future__ import unicode_literals - import pytest import boto import boto3 from boto.exception import EC2ResponseError -from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_ec2_deprecated, mock_ec2 diff --git a/tests/test_ec2/test_iam_integration.py b/tests/test_ec2/test_iam_integration.py index 207901ffe..c8871edb2 100644 --- a/tests/test_ec2/test_iam_integration.py +++ b/tests/test_ec2/test_iam_integration.py @@ -1,14 +1,10 @@ -from __future__ import unicode_literals - import pytest -import time -import json import boto3 from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import -from moto import mock_ec2, mock_iam, mock_cloudformation +from moto import mock_ec2, mock_iam from tests import EXAMPLE_AMI_ID from uuid import uuid4 diff --git a/tests/test_ec2/test_instance_type_offerings.py b/tests/test_ec2/test_instance_type_offerings.py index 398bb605d..624fba5a3 100644 --- a/tests/test_ec2/test_instance_type_offerings.py +++ b/tests/test_ec2/test_instance_type_offerings.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_instance_types.py b/tests/test_ec2/test_instance_types.py index 6028b0e4d..57b6897e5 100644 --- a/tests/test_ec2/test_instance_types.py +++ b/tests/test_ec2/test_instance_types.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from botocore.exceptions import ClientError diff --git a/tests/test_ec2/test_instances.py b/tests/test_ec2/test_instances.py index abc0d36a5..471321193 100644 --- a/tests/test_ec2/test_instances.py +++ b/tests/test_ec2/test_instances.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from botocore.exceptions import ClientError import pytest @@ -13,7 +11,7 @@ import boto3 from boto.ec2.instance import Reservation, InstanceAttribute from boto.exception import EC2ResponseError from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2_deprecated, mock_ec2, settings from moto.core import ACCOUNT_ID @@ -27,7 +25,7 @@ decode_method = base64.decodebytes ################ Test Readme ############### def add_servers(ami_id, count): conn = boto.connect_ec2() - for index in range(count): + for _ in range(count): conn.run_instances(ami_id) @@ -476,6 +474,7 @@ def test_get_paginated_instances(): res1 = resp1["Reservations"] res1.should.have.length_of(5) next_token = resp1["NextToken"] + next_token.should_not.be.none resp2 = client.describe_instances(InstanceIds=instance_ids, NextToken=next_token) @@ -631,7 +630,7 @@ def test_get_instances_filtering_by_state_boto3(): def test_get_instances_filtering_by_instance_id(): conn = boto.connect_ec2() reservation = conn.run_instances(EXAMPLE_AMI_ID, min_count=3) - instance1, instance2, instance3 = reservation.instances + instance1, instance2, _ = reservation.instances reservations = conn.get_all_reservations(filters={"instance-id": instance1.id}) # get_all_reservations should return just instance1 @@ -653,9 +652,9 @@ def test_get_instances_filtering_by_instance_id_boto3(): ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") reservation = ec2.create_instances(ImageId=EXAMPLE_AMI_ID, MinCount=3, MaxCount=3) - instance1, instance2, instance3 = reservation + instance1, instance2, _ = reservation - def filter(values, exists=True): + def _filter(values, exists=True): f = [{"Name": "instance-id", "Values": values}] r = client.describe_instances(Filters=f)["Reservations"] if exists: @@ -665,9 +664,9 @@ def test_get_instances_filtering_by_instance_id_boto3(): else: r.should.have.length_of(0) - filter(values=[instance1.id]) - filter(values=[instance1.id, instance2.id]) - filter(values=["non-existing-id"], exists=False) + _filter(values=[instance1.id]) + _filter(values=[instance1.id, instance2.id]) + _filter(values=["non-existing-id"], exists=False) # Has boto3 equivalent @@ -924,8 +923,7 @@ def test_get_instances_filtering_by_vpc_id_boto3(): @mock_ec2_deprecated def test_get_instances_filtering_by_architecture(): conn = boto.connect_ec2() - reservation = conn.run_instances(EXAMPLE_AMI_ID, min_count=1) - instance = reservation.instances + conn.run_instances(EXAMPLE_AMI_ID, min_count=1) reservations = conn.get_all_reservations(filters={"architecture": "x86_64"}) # get_all_reservations should return the instance @@ -3109,7 +3107,7 @@ def test_describe_instances_dryrun(): ) -def retrieve_all_reservations(client, filters=[]): +def retrieve_all_reservations(client, filters=[]): # pylint: disable=W0102 resp = client.describe_instances(Filters=filters) all_reservations = resp["Reservations"] next_token = resp.get("NextToken") @@ -3120,6 +3118,6 @@ def retrieve_all_reservations(client, filters=[]): return all_reservations -def retrieve_all_instances(client, filters=[]): +def retrieve_all_instances(client, filters=[]): # pylint: disable=W0102 reservations = retrieve_all_reservations(client, filters) return [i for r in reservations for i in r["Instances"]] diff --git a/tests/test_ec2/test_internet_gateways.py b/tests/test_ec2/test_internet_gateways.py index 18056bb00..0677c89fa 100644 --- a/tests/test_ec2/test_internet_gateways.py +++ b/tests/test_ec2/test_internet_gateways.py @@ -1,16 +1,12 @@ -from __future__ import unicode_literals - import pytest -import re - import boto import boto3 from boto.exception import EC2ResponseError from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2_deprecated, mock_ec2 from uuid import uuid4 @@ -325,7 +321,7 @@ def test_igw_detach_unattached_boto3(): def test_igw_delete(): """internet gateway delete""" conn = boto.connect_vpc("the_key", "the_secret") - vpc = conn.create_vpc(VPC_CIDR) + conn.create_vpc(VPC_CIDR) conn.get_all_internet_gateways().should.have.length_of(0) igw = conn.create_internet_gateway() conn.get_all_internet_gateways().should.have.length_of(1) @@ -448,7 +444,7 @@ def test_igw_filter_by_vpc_id(): conn = boto.connect_vpc("the_key", "the_secret") igw1 = conn.create_internet_gateway() - igw2 = conn.create_internet_gateway() + conn.create_internet_gateway() vpc = conn.create_vpc(VPC_CIDR) conn.attach_internet_gateway(igw1.id, vpc.id) @@ -482,7 +478,7 @@ def test_igw_filter_by_tags(): conn = boto.connect_vpc("the_key", "the_secret") igw1 = conn.create_internet_gateway() - igw2 = conn.create_internet_gateway() + conn.create_internet_gateway() igw1.add_tag("tests", "yes") result = conn.get_all_internet_gateways(filters={"tag:tests": "yes"}) @@ -497,7 +493,7 @@ def test_igw_filter_by_tags_boto3(): client = boto3.client("ec2", "us-west-1") igw1 = ec2.create_internet_gateway() - igw2 = ec2.create_internet_gateway() + ec2.create_internet_gateway() tag_value = str(uuid4()) igw1.create_tags(Tags=[{"Key": "tests", "Value": tag_value}]) @@ -513,7 +509,7 @@ def test_igw_filter_by_internet_gateway_id(): conn = boto.connect_vpc("the_key", "the_secret") igw1 = conn.create_internet_gateway() - igw2 = conn.create_internet_gateway() + conn.create_internet_gateway() result = conn.get_all_internet_gateways(filters={"internet-gateway-id": igw1.id}) result.should.have.length_of(1) @@ -527,7 +523,7 @@ def test_igw_filter_by_internet_gateway_id_boto3(): client = boto3.client("ec2", "us-west-1") igw1 = ec2.create_internet_gateway() - igw2 = ec2.create_internet_gateway() + ec2.create_internet_gateway() result = client.describe_internet_gateways( Filters=[{"Name": "internet-gateway-id", "Values": [igw1.id]}] @@ -543,7 +539,7 @@ def test_igw_filter_by_attachment_state(): conn = boto.connect_vpc("the_key", "the_secret") igw1 = conn.create_internet_gateway() - igw2 = conn.create_internet_gateway() + conn.create_internet_gateway() vpc = conn.create_vpc(VPC_CIDR) conn.attach_internet_gateway(igw1.id, vpc.id) @@ -585,7 +581,7 @@ def test_create_internet_gateway_with_tags(): igw.tags.should.equal([{"Key": "test", "Value": "TestRouteTable"}]) -def retrieve_all(client, filters=[]): +def retrieve_all(client, filters=[]): # pylint: disable=W0102 resp = client.describe_internet_gateways(Filters=filters) all_igws = resp["InternetGateways"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_ip_addresses.py b/tests/test_ec2/test_ip_addresses.py index 60cf1cfc6..57f1944ea 100644 --- a/tests/test_ec2/test_ip_addresses.py +++ b/tests/test_ec2/test_ip_addresses.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_key_pairs.py b/tests/test_ec2/test_key_pairs.py index b9ef6e258..013dd00da 100644 --- a/tests/test_ec2/test_key_pairs.py +++ b/tests/test_ec2/test_key_pairs.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import pytest import boto +import sure # noqa # pylint: disable=unused-import import boto3 -import sure # noqa from boto.exception import EC2ResponseError from botocore.exceptions import ClientError @@ -59,7 +57,6 @@ def test_key_pairs_empty(): def test_key_pairs_empty_boto3(): if settings.TEST_SERVER_MODE: raise SkipTest("ServerMode is not guaranteed to be empty") - ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") client.describe_key_pairs()["KeyPairs"].should.be.empty @@ -78,7 +75,6 @@ def test_key_pairs_invalid_id(): @mock_ec2 def test_key_pairs_invalid_id_boto3(): - ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") with pytest.raises(ClientError) as ex: @@ -233,7 +229,6 @@ def test_key_pairs_delete_exist(): @mock_ec2 def test_key_pairs_delete_exist_boto3(): - ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") key_name = str(uuid4())[0:6] client.create_key_pair(KeyName=key_name) @@ -281,7 +276,6 @@ def test_key_pairs_import(): @mock_ec2 def test_key_pairs_import_boto3(): - ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") key_name = str(uuid4())[0:6] @@ -332,7 +326,6 @@ def test_key_pairs_import_exist(): @mock_ec2 def test_key_pairs_import_exist_boto3(): - ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") key_name = str(uuid4())[0:6] @@ -376,7 +369,6 @@ def test_key_pairs_invalid(): @mock_ec2 def test_key_pairs_invalid_boto3(): - ec2 = boto3.resource("ec2", "us-west-1") client = boto3.client("ec2", "us-west-1") with pytest.raises(ClientError) as ex: diff --git a/tests/test_ec2/test_launch_templates.py b/tests/test_ec2/test_launch_templates.py index 27570cbf8..80926a078 100644 --- a/tests/test_ec2/test_launch_templates.py +++ b/tests/test_ec2/test_launch_templates.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from botocore.client import ClientError @@ -410,7 +410,7 @@ def test_create_launch_template_with_tag_spec(): ) -def retrieve_all_templates(client, filters=[]): +def retrieve_all_templates(client, filters=[]): # pylint: disable=W0102 resp = client.describe_launch_templates(Filters=filters) all_templates = resp["LaunchTemplates"] next_token = resp.get("NextToken") diff --git a/tests/test_ec2/test_monitoring.py b/tests/test_ec2/test_monitoring.py index 95bd36e6a..245c13b88 100644 --- a/tests/test_ec2/test_monitoring.py +++ b/tests/test_ec2/test_monitoring.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_nat_gateway.py b/tests/test_ec2/test_nat_gateway.py index 094dae984..501a1a5c8 100644 --- a/tests/test_ec2/test_nat_gateway.py +++ b/tests/test_ec2/test_nat_gateway.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, settings from unittest import SkipTest @@ -260,7 +259,7 @@ def test_describe_nat_gateway_filter_vpc_id(): ].should.equal(allocation_id_1) -def retrieve_all_gateways(client, filters=[]): +def retrieve_all_gateways(client, filters=[]): # pylint: disable=W0102 resp = client.describe_nat_gateways(Filters=filters) all_gws = resp["NatGateways"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_network_acls.py b/tests/test_ec2/test_network_acls.py index 359ff1548..aadfca125 100644 --- a/tests/test_ec2/test_network_acls.py +++ b/tests/test_ec2/test_network_acls.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from botocore.exceptions import ClientError @@ -15,7 +14,7 @@ from unittest import SkipTest @mock_ec2_deprecated def test_default_network_acl_created_with_vpc(): conn = boto.connect_vpc("the_key", "the secret") - vpc = conn.create_vpc("10.0.0.0/16") + conn.create_vpc("10.0.0.0/16") all_network_acls = conn.get_all_network_acls() all_network_acls.should.have.length_of(2) @@ -37,7 +36,7 @@ def test_default_network_acl_created_with_vpc_boto3(): def test_network_acls(): conn = boto.connect_vpc("the_key", "the secret") vpc = conn.create_vpc("10.0.0.0/16") - network_acl = conn.create_network_acl(vpc.id) + conn.create_network_acl(vpc.id) all_network_acls = conn.get_all_network_acls() all_network_acls.should.have.length_of(3) @@ -99,7 +98,7 @@ def test_network_acl_entries(): network_acl = conn.create_network_acl(vpc.id) - network_acl_entry = conn.create_network_acl_entry( + conn.create_network_acl_entry( network_acl.id, 110, 6, @@ -315,7 +314,7 @@ def test_associate_new_network_acl_with_subnet(): def test_delete_network_acl(): conn = boto.connect_vpc("the_key", "the secret") vpc = conn.create_vpc("10.0.0.0/16") - subnet = conn.create_subnet(vpc.id, "10.0.0.0/18") + conn.create_subnet(vpc.id, "10.0.0.0/18") network_acl = conn.create_network_acl(vpc.id) all_network_acls = conn.get_all_network_acls() diff --git a/tests/test_ec2/test_placement_groups.py b/tests/test_ec2/test_placement_groups.py index bc389488b..260d01056 100644 --- a/tests/test_ec2/test_placement_groups.py +++ b/tests/test_ec2/test_placement_groups.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_prefix_lists.py b/tests/test_ec2/test_prefix_lists.py index cd8629b5d..e145f57cb 100644 --- a/tests/test_ec2/test_prefix_lists.py +++ b/tests/test_ec2/test_prefix_lists.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, settings from moto.core import ACCOUNT_ID diff --git a/tests/test_ec2/test_regions.py b/tests/test_ec2/test_regions.py index a3ea7ade7..e92d0f793 100644 --- a/tests/test_ec2/test_regions.py +++ b/tests/test_ec2/test_regions.py @@ -1,10 +1,9 @@ -from __future__ import unicode_literals import boto.ec2 import boto.ec2.autoscale import boto.ec2.elb import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto3 import Session from botocore.exceptions import ClientError @@ -32,7 +31,7 @@ def test_use_boto_regions(): def add_servers_to_region(ami_id, count, region): conn = boto.ec2.connect_to_region(region) - for index in range(count): + for _ in range(count): conn.run_instances(ami_id) @@ -135,7 +134,7 @@ def test_create_autoscaling_group(): config = boto.ec2.autoscale.LaunchConfiguration( name="us_tester", image_id=EXAMPLE_AMI_ID, instance_type="m1.small" ) - x = us_conn.create_launch_configuration(config) + us_conn.create_launch_configuration(config) us_subnet_id = list(ec2_backends["us-east-1"].subnets["us-east-1c"].keys())[0] ap_subnet_id = list( diff --git a/tests/test_ec2/test_reserved_instances.py b/tests/test_ec2/test_reserved_instances.py index 47456bc03..e8ec9bdc5 100644 --- a/tests/test_ec2/test_reserved_instances.py +++ b/tests/test_ec2/test_reserved_instances.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_route_tables.py b/tests/test_ec2/test_route_tables.py index 044c38191..0fe105fb6 100644 --- a/tests/test_ec2/test_route_tables.py +++ b/tests/test_ec2/test_route_tables.py @@ -1,12 +1,10 @@ -from __future__ import unicode_literals - import pytest import boto import boto3 from boto.exception import EC2ResponseError from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_ec2_deprecated, settings from tests import EXAMPLE_AMI_ID @@ -274,8 +272,8 @@ def test_route_tables_filters_associations(): route_table2 = conn.create_route_table(vpc.id) association_id1 = conn.associate_route_table(route_table1.id, subnet1.id) - association_id2 = conn.associate_route_table(route_table1.id, subnet2.id) - association_id3 = conn.associate_route_table(route_table2.id, subnet3.id) + conn.associate_route_table(route_table1.id, subnet2.id) + conn.associate_route_table(route_table2.id, subnet3.id) all_route_tables = conn.get_all_route_tables() all_route_tables.should.have.length_of(4) @@ -708,7 +706,7 @@ def test_routes_additional(): conn = boto.connect_vpc("the_key", "the_secret") vpc = conn.create_vpc("10.0.0.0/16") main_route_table = conn.get_all_route_tables(filters={"vpc-id": vpc.id})[0] - local_route = main_route_table.routes[0] + igw = conn.create_internet_gateway() ROUTE_CIDR = "10.0.0.4/24" @@ -814,7 +812,7 @@ def test_routes_replace(): main_route_table = conn.get_all_route_tables( filters={"association.main": "true", "vpc-id": vpc.id} )[0] - local_route = main_route_table.routes[0] + ROUTE_CIDR = "10.0.0.4/24" # Various route targets @@ -936,10 +934,10 @@ def test_routes_replace_boto3(): @mock_ec2_deprecated def test_routes_not_supported(): conn = boto.connect_vpc("the_key", "the_secret") - vpc = conn.create_vpc("10.0.0.0/16") + conn.create_vpc("10.0.0.0/16") main_route_table = conn.get_all_route_tables()[0] - local_route = main_route_table.routes[0] - igw = conn.create_internet_gateway() + + conn.create_internet_gateway() ROUTE_CIDR = "10.0.0.4/24" # Create @@ -1005,7 +1003,7 @@ def test_routes_vpc_peering_connection(): main_route_table = conn.get_all_route_tables( filters={"association.main": "true", "vpc-id": vpc.id} )[0] - local_route = main_route_table.routes[0] + ROUTE_CIDR = "10.0.0.4/24" peer_vpc = conn.create_vpc("11.0.0.0/16") @@ -1391,7 +1389,7 @@ def test_create_route_with_unknown_egress_only_igw(): ec2_client = boto3.client("ec2", region_name="eu-central-1") vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16") - subnet = ec2.create_subnet( + ec2.create_subnet( VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-2a" ) diff --git a/tests/test_ec2/test_security_groups.py b/tests/test_ec2/test_security_groups.py index 7e0f822f6..7c5ce1b60 100644 --- a/tests/test_ec2/test_security_groups.py +++ b/tests/test_ec2/test_security_groups.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import copy import json import unittest @@ -11,7 +9,7 @@ import boto import boto.ec2 from botocore.exceptions import ClientError from boto.exception import EC2ResponseError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_ec2_deprecated, settings from moto.ec2 import ec2_backend @@ -1487,7 +1485,7 @@ def test_security_group_filter_ip_permission(): describe[0]["GroupName"].should.equal(sg_name) -def retrieve_all_sgs(conn, filters=[]): +def retrieve_all_sgs(conn, filters=[]): # pylint: disable=W0102 res = conn.describe_security_groups(Filters=filters) all_groups = res["SecurityGroups"] next_token = res.get("NextToken") @@ -1915,7 +1913,7 @@ def test_filter_description(): sg1 = vpc.create_security_group( Description=(f"A {unique} Description"), GroupName="test-1" ) - sg2 = vpc.create_security_group( + vpc.create_security_group( Description="Another Description That Awes The Human Mind", GroupName="test-2" ) diff --git a/tests/test_ec2/test_security_groups_cloudformation.py b/tests/test_ec2/test_security_groups_cloudformation.py index e06c11ddc..13800130d 100644 --- a/tests/test_ec2/test_security_groups_cloudformation.py +++ b/tests/test_ec2/test_security_groups_cloudformation.py @@ -1,11 +1,10 @@ import boto3 +import sure # noqa # pylint: disable=unused-import import json -import sure # noqa from moto import mock_cloudformation, mock_ec2 from tests import EXAMPLE_AMI_ID from string import Template from uuid import uuid4 -from .test_instances import retrieve_all_instances SEC_GROUP_INGRESS = Template( diff --git a/tests/test_ec2/test_server.py b/tests/test_ec2/test_server.py index c5e52e20e..756482e59 100644 --- a/tests/test_ec2/test_server.py +++ b/tests/test_ec2/test_server.py @@ -1,6 +1,5 @@ -from __future__ import unicode_literals import re -import sure # noqa +import sure # noqa # pylint: disable=unused-import import xmltodict import moto.server as server diff --git a/tests/test_ec2/test_spot_fleet.py b/tests/test_ec2/test_spot_fleet.py index d82aff89f..4ba9c91bb 100644 --- a/tests/test_ec2/test_spot_fleet.py +++ b/tests/test_ec2/test_spot_fleet.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 from moto.core import ACCOUNT_ID diff --git a/tests/test_ec2/test_spot_instances.py b/tests/test_ec2/test_spot_instances.py index 3bd4e5e02..bc95a5b05 100644 --- a/tests/test_ec2/test_spot_instances.py +++ b/tests/test_ec2/test_spot_instances.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import pytest import datetime @@ -8,7 +7,7 @@ import boto3 from boto.exception import EC2ResponseError from botocore.exceptions import ClientError import pytz -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_ec2_deprecated, settings from moto.ec2.models import ec2_backends @@ -251,7 +250,6 @@ def test_request_spot_instances_fulfilled_boto3(): """ Test that moto correctly fullfills a spot instance request """ - ec2 = boto3.resource("ec2", region_name="us-east-1") client = boto3.client("ec2", region_name="us-east-1") request = client.request_spot_instances( @@ -436,7 +434,7 @@ def test_request_spot_instances_instance_lifecycle(): # And we can't just pick the first instance in ServerMode and expect it to be the right one raise SkipTest("ServerMode is not guaranteed to be empty") client = boto3.client("ec2", region_name="us-east-1") - request = client.request_spot_instances(SpotPrice="0.5") + client.request_spot_instances(SpotPrice="0.5") response = client.describe_instances() diff --git a/tests/test_ec2/test_subnets.py b/tests/test_ec2/test_subnets.py index a96d1f9e7..ec7f9fd16 100644 --- a/tests/test_ec2/test_subnets.py +++ b/tests/test_ec2/test_subnets.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import random import boto @@ -7,7 +5,7 @@ import boto3 import boto.vpc import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto.exception import EC2ResponseError from botocore.exceptions import ClientError from moto import mock_ec2, mock_ec2_deprecated, settings @@ -253,7 +251,7 @@ def test_modify_subnet_attribute_assign_ipv6_address_on_creation(): # 'map_public_ip_on_launch' is set when calling 'DescribeSubnets' action subnet.reload() - subnets = client.describe_subnets() + client.describe_subnets() # For non default subnet, attribute value should be 'False' subnet.assign_ipv6_address_on_creation.shouldnt.be.ok @@ -273,10 +271,10 @@ def test_modify_subnet_attribute_assign_ipv6_address_on_creation(): @mock_ec2 def test_modify_subnet_attribute_validation(): + # TODO: implement some actual logic ec2 = boto3.resource("ec2", region_name="us-west-1") - client = boto3.client("ec2", region_name="us-west-1") vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16") - subnet = ec2.create_subnet( + ec2.create_subnet( VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a" ) @@ -284,7 +282,6 @@ def test_modify_subnet_attribute_validation(): # Has boto3 equivalent @mock_ec2_deprecated def test_subnet_get_by_id(): - ec2 = boto.ec2.connect_to_region("us-west-1") conn = boto.vpc.connect_to_region("us-west-1") vpcA = conn.create_vpc("10.0.0.0/16") subnetA = conn.create_subnet(vpcA.id, "10.0.0.0/24", availability_zone="us-west-1a") @@ -292,9 +289,7 @@ def test_subnet_get_by_id(): subnetB1 = conn.create_subnet( vpcB.id, "10.0.0.0/24", availability_zone="us-west-1a" ) - subnetB2 = conn.create_subnet( - vpcB.id, "10.0.1.0/24", availability_zone="us-west-1b" - ) + conn.create_subnet(vpcB.id, "10.0.1.0/24", availability_zone="us-west-1b") subnets_by_id = conn.get_all_subnets(subnet_ids=[subnetA.id, subnetB1.id]) subnets_by_id.should.have.length_of(2) @@ -321,7 +316,7 @@ def test_subnet_get_by_id_boto3(): subnetB1 = ec2.create_subnet( VpcId=vpcB.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-1a" ) - subnetB2 = ec2.create_subnet( + ec2.create_subnet( VpcId=vpcB.id, CidrBlock="10.0.1.0/24", AvailabilityZone="us-west-1b" ) @@ -595,7 +590,7 @@ def test_create_subnet_with_invalid_availability_zone(): subnet_availability_zone = "asfasfas" with pytest.raises(ClientError) as ex: - subnet = client.create_subnet( + client.create_subnet( VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone=subnet_availability_zone, @@ -618,7 +613,7 @@ def test_create_subnet_with_invalid_cidr_range(): subnet_cidr_block = "10.1.0.0/20" with pytest.raises(ClientError) as ex: - subnet = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) + ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) str(ex.value).should.equal( "An error occurred (InvalidSubnet.Range) when calling the CreateSubnet " "operation: The CIDR '{}' is invalid.".format(subnet_cidr_block) @@ -636,7 +631,7 @@ def test_create_subnet_with_invalid_cidr_range_multiple_vpc_cidr_blocks(): subnet_cidr_block = "10.2.0.0/20" with pytest.raises(ClientError) as ex: - subnet = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) + ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) str(ex.value).should.equal( "An error occurred (InvalidSubnet.Range) when calling the CreateSubnet " "operation: The CIDR '{}' is invalid.".format(subnet_cidr_block) @@ -653,7 +648,7 @@ def test_create_subnet_with_invalid_cidr_block_parameter(): subnet_cidr_block = "1000.1.0.0/20" with pytest.raises(ClientError) as ex: - subnet = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) + ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) str(ex.value).should.equal( "An error occurred (InvalidParameterValue) when calling the CreateSubnet " "operation: Value ({}) for parameter cidrBlock is invalid. This is not a valid CIDR block.".format( @@ -712,8 +707,8 @@ def test_create_subnets_with_overlapping_cidr_blocks(): subnet_cidr_block = "10.0.0.0/24" with pytest.raises(ClientError) as ex: - subnet1 = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) - subnet2 = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) + ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) + ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block) str(ex.value).should.equal( "An error occurred (InvalidSubnet.Conflict) when calling the CreateSubnet " "operation: The CIDR '{}' conflicts with another subnet".format( @@ -820,7 +815,7 @@ def validate_subnet_details_after_creating_eni( nr_of_eni_to_create = random.randint(0, 5) ip_addresses_assigned = 0 enis_created = [] - for i in range(0, nr_of_eni_to_create): + for _ in range(0, nr_of_eni_to_create): # Create a random number of IP addresses per ENI nr_of_ip_addresses = random.randint(1, 5) if nr_of_ip_addresses == 1: diff --git a/tests/test_ec2/test_tags.py b/tests/test_ec2/test_tags.py index 2f9598972..7dc5d7612 100644 --- a/tests/test_ec2/test_tags.py +++ b/tests/test_ec2/test_tags.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import pytest import itertools @@ -8,10 +7,9 @@ import boto3 from botocore.exceptions import ClientError from boto.exception import EC2ResponseError from boto.ec2.instance import Reservation -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2_deprecated, mock_ec2 -import pytest from tests import EXAMPLE_AMI_ID from .test_instances import retrieve_all_instances from uuid import uuid4 @@ -868,7 +866,7 @@ def get_filter(tag_val): ] -def retrieve_all_tagged(client, filters=[]): +def retrieve_all_tagged(client, filters=[]): # pylint: disable=W0102 resp = client.describe_tags(Filters=filters) tags = resp["Tags"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_transit_gateway.py b/tests/test_ec2/test_transit_gateway.py index 622f11433..895a49433 100644 --- a/tests/test_ec2/test_transit_gateway.py +++ b/tests/test_ec2/test_transit_gateway.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, settings from moto.core import ACCOUNT_ID from unittest import SkipTest @@ -102,10 +102,10 @@ def test_delete_transit_gateway(): @mock_ec2 def test_describe_transit_gateway_by_id(): ec2 = boto3.client("ec2", region_name="us-west-1") - g1 = ec2.create_transit_gateway(Description="my first gatway")["TransitGateway"] + ec2.create_transit_gateway(Description="my first gatway")["TransitGateway"] g2 = ec2.create_transit_gateway(Description="my second gatway")["TransitGateway"] g2_id = g2["TransitGatewayId"] - g3 = ec2.create_transit_gateway(Description="my third gatway")["TransitGateway"] + ec2.create_transit_gateway(Description="my third gatway")["TransitGateway"] my_gateway = ec2.describe_transit_gateways(TransitGatewayIds=[g2_id])[ "TransitGateways" @@ -125,9 +125,7 @@ def test_modify_transit_gateway(): ][0] my_gateway["Description"].should.equal("my first gatway") - resp = ec2.modify_transit_gateway( - TransitGatewayId=g_id, Description="my first gateway" - ) + ec2.modify_transit_gateway(TransitGatewayId=g_id, Description="my first gateway") my_gateway = ec2.describe_transit_gateways(TransitGatewayIds=[g_id])[ "TransitGateways" diff --git a/tests/test_ec2/test_transit_gateway_cloudformation.py b/tests/test_ec2/test_transit_gateway_cloudformation.py index 528db9d4f..32d6657de 100644 --- a/tests/test_ec2/test_transit_gateway_cloudformation.py +++ b/tests/test_ec2/test_transit_gateway_cloudformation.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import ( mock_cloudformation, diff --git a/tests/test_ec2/test_transit_gateway_peering_attachments.py b/tests/test_ec2/test_transit_gateway_peering_attachments.py index cbdc9223e..8fe86e397 100644 --- a/tests/test_ec2/test_transit_gateway_peering_attachments.py +++ b/tests/test_ec2/test_transit_gateway_peering_attachments.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, settings from moto.core import ACCOUNT_ID from unittest import SkipTest @@ -190,7 +190,7 @@ def create_peering_attachment(ec2, gateway_id1, gateway_id2): )["TransitGatewayPeeringAttachment"]["TransitGatewayAttachmentId"] -def retrieve_all_attachments(client, filters=[]): +def retrieve_all_attachments(client, filters=[]): # pylint: disable=W0102 resp = client.describe_transit_gateway_peering_attachments(Filters=filters) attmnts = resp["TransitGatewayPeeringAttachments"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_virtual_private_gateways.py b/tests/test_ec2/test_virtual_private_gateways.py index 2d45d6338..1d23f9e12 100644 --- a/tests/test_ec2/test_virtual_private_gateways.py +++ b/tests/test_ec2/test_virtual_private_gateways.py @@ -1,8 +1,7 @@ -from __future__ import unicode_literals import boto import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2_deprecated, mock_ec2 from botocore.exceptions import ClientError @@ -76,6 +75,28 @@ def test_describe_vpn_connections_attachment_vpc_id_filter(): ) +@mock_ec2 +def test_describe_vpn_connections_state_filter_attached(): + """describe_vpn_gateways attachment.state filter - match attached""" + + ec2 = boto3.client("ec2", region_name="us-east-1") + + vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16") + vpc_id = vpc["Vpc"]["VpcId"] + gateway = ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") + gateway_id = gateway["VpnGateway"]["VpnGatewayId"] + + ec2.attach_vpn_gateway(VpcId=vpc_id, VpnGatewayId=gateway_id) + + all_gateways = retrieve_all( + ec2, [{"Name": "attachment.state", "Values": ["attached"]}] + ) + + [gw["VpnGatewayId"] for gw in all_gateways].should.contain(gateway_id) + my_gateway = [gw for gw in all_gateways if gw["VpnGatewayId"] == gateway_id][0] + my_gateway["VpcAttachments"].should.contain({"State": "attached", "VpcId": vpc_id}) + + @mock_ec2 def test_describe_vpn_connections_state_filter_deatched(): """describe_vpn_gateways attachment.state filter - don't match detatched""" @@ -96,6 +117,67 @@ def test_describe_vpn_connections_state_filter_deatched(): gateways["VpnGateways"].should.have.length_of(0) +@mock_ec2 +def test_describe_vpn_connections_id_filter_match(): + """describe_vpn_gateways vpn-gateway-id filter - match correct id""" + + ec2 = boto3.client("ec2", region_name="us-east-1") + + gateway = ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") + gateway_id = gateway["VpnGateway"]["VpnGatewayId"] + + gateways = ec2.describe_vpn_gateways( + Filters=[{"Name": "vpn-gateway-id", "Values": [gateway_id]}] + ) + + gateways["VpnGateways"].should.have.length_of(1) + gateways["VpnGateways"][0]["VpnGatewayId"].should.equal(gateway_id) + + +@mock_ec2 +def test_describe_vpn_connections_id_filter_miss(): + """describe_vpn_gateways vpn-gateway-id filter - don't match""" + + ec2 = boto3.client("ec2", region_name="us-east-1") + + ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") + + gateways = ec2.describe_vpn_gateways( + Filters=[{"Name": "vpn-gateway-id", "Values": ["unknown_gateway_id"]}] + ) + + gateways["VpnGateways"].should.have.length_of(0) + + +@mock_ec2 +def test_describe_vpn_connections_type_filter_match(): + """describe_vpn_gateways type filter - match""" + + ec2 = boto3.client("ec2", region_name="us-east-1") + + gateway = ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") + gateway_id = gateway["VpnGateway"]["VpnGatewayId"] + + my_gateways = retrieve_all(ec2, [{"Name": "type", "Values": ["ipsec.1"]}]) + + [gw["VpnGatewayId"] for gw in my_gateways].should.contain(gateway_id) + + +@mock_ec2 +def test_describe_vpn_connections_type_filter_miss(): + """describe_vpn_gateways type filter - don't match""" + + ec2 = boto3.client("ec2", region_name="us-east-1") + + ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") + + gateways = ec2.describe_vpn_gateways( + Filters=[{"Name": "type", "Values": ["unknown_type"]}] + ) + + gateways["VpnGateways"].should.have.length_of(0) + + # Has boto3 equivalent @mock_ec2_deprecated def test_virtual_private_gateways(): @@ -161,91 +243,6 @@ def test_describe_vpn_gateway_boto3(): gateway["AvailabilityZone"].should.equal("us-east-1a") -@mock_ec2 -def test_describe_vpn_connections_state_filter_attached(): - """ describe_vpn_gateways attachment.state filter - match attached """ - - ec2 = boto3.client("ec2", region_name="us-east-1") - - vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16") - vpc_id = vpc["Vpc"]["VpcId"] - gateway = ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") - gateway_id = gateway["VpnGateway"]["VpnGatewayId"] - - ec2.attach_vpn_gateway(VpcId=vpc_id, VpnGatewayId=gateway_id) - - all_gateways = retrieve_all( - ec2, [{"Name": "attachment.state", "Values": ["attached"]}] - ) - - [gw["VpnGatewayId"] for gw in all_gateways].should.contain(gateway_id) - - my_gateway = [gw for gw in all_gateways if gw["VpnGatewayId"] == gateway_id][0] - - my_gateway["VpcAttachments"].should.contain({"State": "attached", "VpcId": vpc_id}) - - -@mock_ec2 -def test_describe_vpn_connections_id_filter_match(): - """ describe_vpn_gateways vpn-gateway-id filter - match correct id """ - - ec2 = boto3.client("ec2", region_name="us-east-1") - - gateway = ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") - gateway_id = gateway["VpnGateway"]["VpnGatewayId"] - - gateways = ec2.describe_vpn_gateways( - Filters=[{"Name": "vpn-gateway-id", "Values": [gateway_id]}] - ) - - gateways["VpnGateways"].should.have.length_of(1) - gateways["VpnGateways"][0]["VpnGatewayId"].should.equal(gateway_id) - - -@mock_ec2 -def test_describe_vpn_connections_id_filter_miss(): - """ describe_vpn_gateways vpn-gateway-id filter - don't match """ - - ec2 = boto3.client("ec2", region_name="us-east-1") - - ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") - - gateways = ec2.describe_vpn_gateways( - Filters=[{"Name": "vpn-gateway-id", "Values": ["unknown_gateway_id"]}] - ) - - gateways["VpnGateways"].should.have.length_of(0) - - -@mock_ec2 -def test_describe_vpn_connections_type_filter_match(): - """ describe_vpn_gateways type filter - match """ - - ec2 = boto3.client("ec2", region_name="us-east-1") - - gateway = ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") - gateway_id = gateway["VpnGateway"]["VpnGatewayId"] - - my_gateways = retrieve_all(ec2, [{"Name": "type", "Values": ["ipsec.1"]}]) - - [gw["VpnGatewayId"] for gw in my_gateways].should.contain(gateway_id) - - -@mock_ec2 -def test_describe_vpn_connections_type_filter_miss(): - """ describe_vpn_gateways type filter - don't match """ - - ec2 = boto3.client("ec2", region_name="us-east-1") - - ec2.create_vpn_gateway(AvailabilityZone="us-east-1a", Type="ipsec.1") - - gateways = ec2.describe_vpn_gateways( - Filters=[{"Name": "type", "Values": ["unknown_type"]}] - ) - - gateways["VpnGateways"].should.have.length_of(0) - - # Has boto3 equivalent @mock_ec2_deprecated def test_vpn_gateway_vpc_attachment(): @@ -293,7 +290,6 @@ def test_delete_vpn_gateway(): @mock_ec2 def test_delete_vpn_gateway_boto3(): - ec2 = boto3.resource("ec2", region_name="us-west-1") client = boto3.client("ec2", region_name="us-west-1") vpn_gateway = client.create_vpn_gateway( Type="ipsec.1", AvailabilityZone="us-east-1a" @@ -325,7 +321,6 @@ def test_vpn_gateway_tagging(): @mock_ec2 def test_vpn_gateway_tagging_boto3(): - ec2 = boto3.resource("ec2", region_name="us-west-1") client = boto3.client("ec2", region_name="us-west-1") vpn_gateway = client.create_vpn_gateway( Type="ipsec.1", AvailabilityZone="us-east-1a" @@ -394,7 +389,7 @@ def test_detach_vpn_gateway_boto3(): attachments.should.equal([{"State": "detached", "VpcId": vpc.id}]) -def retrieve_all(client, filters=[]): +def retrieve_all(client, filters=[]): # pylint: disable=W0102 resp = client.describe_vpn_gateways(Filters=filters) all_gateways = resp["VpnGateways"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_vm_export.py b/tests/test_ec2/test_vm_export.py index 08215d067..94b543379 100644 --- a/tests/test_ec2/test_vm_export.py +++ b/tests/test_ec2/test_vm_export.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_vm_import.py b/tests/test_ec2/test_vm_import.py index 0ebfaaa0c..9ad3516fd 100644 --- a/tests/test_ec2/test_vm_import.py +++ b/tests/test_ec2/test_vm_import.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ec2/test_vpc_peering.py b/tests/test_ec2/test_vpc_peering.py index 35ad07bf1..656547bab 100644 --- a/tests/test_ec2/test_vpc_peering.py +++ b/tests/test_ec2/test_vpc_peering.py @@ -1,13 +1,10 @@ -from __future__ import unicode_literals - import pytest -from moto.ec2.exceptions import EC2ClientError from botocore.exceptions import ClientError import boto3 import boto from boto.exception import EC2ResponseError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_ec2_deprecated from tests.helpers import requires_boto_gte @@ -314,7 +311,7 @@ def test_modify_vpc_peering_connections_unknown_vpc(): ec2_apn1 = boto3.resource("ec2", region_name="ap-northeast-1") vpc_apn1 = ec2_apn1.create_vpc(CidrBlock="10.20.0.0/16") # create peering - vpc_pcx_usw1 = ec2_usw1.create_vpc_peering_connection( + ec2_usw1.create_vpc_peering_connection( VpcId=vpc_usw1.id, PeerVpcId=vpc_apn1.id, PeerRegion="ap-northeast-1" ) # diff --git a/tests/test_ec2/test_vpcs.py b/tests/test_ec2/test_vpcs.py index b6f1be49b..5d428f591 100644 --- a/tests/test_ec2/test_vpcs.py +++ b/tests/test_ec2/test_vpcs.py @@ -1,14 +1,11 @@ -from __future__ import unicode_literals - import pytest -from moto.ec2.exceptions import EC2ClientError from botocore.exceptions import ClientError import boto3 import boto from boto.exception import EC2ResponseError -import sure # noqa +import sure # noqa # pylint: disable=unused-import import random from moto import mock_ec2, mock_ec2_deprecated @@ -186,7 +183,7 @@ def test_vpc_state_available_filter_boto3(): [v["VpcId"] for v in available].should.contain(vpc2.id) -def retrieve_all_vpcs(client, filters=[]): +def retrieve_all_vpcs(client, filters=[]): # pylint: disable=W0102 resp = client.describe_vpcs(Filters=filters) all_vpcs = resp["Vpcs"] token = resp.get("NextToken") @@ -1020,7 +1017,7 @@ def test_create_vpc_with_invalid_cidr_block_parameter(): vpc_cidr_block = "1000.1.0.0/20" with pytest.raises(ClientError) as ex: - vpc = ec2.create_vpc(CidrBlock=vpc_cidr_block) + ec2.create_vpc(CidrBlock=vpc_cidr_block) str(ex.value).should.equal( "An error occurred (InvalidParameterValue) when calling the CreateVpc " "operation: Value ({}) for parameter cidrBlock is invalid. This is not a valid CIDR block.".format( @@ -1035,7 +1032,7 @@ def test_create_vpc_with_invalid_cidr_range(): vpc_cidr_block = "10.1.0.0/29" with pytest.raises(ClientError) as ex: - vpc = ec2.create_vpc(CidrBlock=vpc_cidr_block) + ec2.create_vpc(CidrBlock=vpc_cidr_block) str(ex.value).should.equal( "An error occurred (InvalidVpc.Range) when calling the CreateVpc " "operation: The CIDR '{}' is invalid.".format(vpc_cidr_block) diff --git a/tests/test_ec2/test_vpn_connections.py b/tests/test_ec2/test_vpn_connections.py index 2fc076a3e..fa15361de 100644 --- a/tests/test_ec2/test_vpn_connections.py +++ b/tests/test_ec2/test_vpn_connections.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - import boto import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto.exception import EC2ResponseError from botocore.exceptions import ClientError from moto import mock_ec2, mock_ec2_deprecated @@ -173,7 +171,7 @@ def test_describe_vpn_connections_unknown(): err["Code"].should.equal("InvalidVpnConnectionID.NotFound") -def retrieve_all_vpncs(client, filters=[]): +def retrieve_all_vpncs(client, filters=[]): # pylint: disable=W0102 resp = client.describe_vpn_connections(Filters=filters) all_vpncs = resp["VpnConnections"] token = resp.get("NextToken") diff --git a/tests/test_ec2/test_windows.py b/tests/test_ec2/test_windows.py index ae2f7b29a..bd8afe5ba 100644 --- a/tests/test_ec2/test_windows.py +++ b/tests/test_ec2/test_windows.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals -import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 diff --git a/tests/test_ecr/test_ecr_boto3.py b/tests/test_ecr/test_ecr_boto3.py index d269ab309..77e7b64b2 100644 --- a/tests/test_ecr/test_ecr_boto3.py +++ b/tests/test_ecr/test_ecr_boto3.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import hashlib import json from datetime import datetime @@ -10,7 +8,7 @@ import os from random import random import re -import sure # noqa +import sure # noqa # pylint: disable=unused-import import boto3 from botocore.exceptions import ClientError @@ -2263,11 +2261,11 @@ def test_start_image_scan_error_daily_limit(): repo_name = "test-repo" client.create_repository(repositoryName=repo_name) image_tag = "latest" - image_digest = client.put_image( + client.put_image( repositoryName=repo_name, imageManifest=json.dumps(_create_image_manifest()), imageTag="latest", - )["image"]["imageId"]["imageDigest"] + ) client.start_image_scan(repositoryName=repo_name, imageId={"imageTag": image_tag}) # when diff --git a/tests/test_ecr/test_ecr_cloudformation.py b/tests/test_ecr/test_ecr_cloudformation.py index bb6a3f8df..680c8c86e 100644 --- a/tests/test_ecr/test_ecr_cloudformation.py +++ b/tests/test_ecr/test_ecr_cloudformation.py @@ -4,7 +4,7 @@ from string import Template import boto3 import json from moto import mock_cloudformation, mock_ecr -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.core import ACCOUNT_ID diff --git a/tests/test_ecr/test_ecr_policy_validation.py b/tests/test_ecr/test_ecr_policy_validation.py index 7cdcd25f4..0e3f7565c 100644 --- a/tests/test_ecr/test_ecr_policy_validation.py +++ b/tests/test_ecr/test_ecr_policy_validation.py @@ -1,7 +1,7 @@ import json import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.ecr.exceptions import InvalidParameterException from moto.ecr.policy_validation import EcrLifecyclePolicyValidator diff --git a/tests/test_ecs/test_ecs_boto3.py b/tests/test_ecs/test_ecs_boto3.py index 9d130ba83..02ae901de 100644 --- a/tests/test_ecs/test_ecs_boto3.py +++ b/tests/test_ecs/test_ecs_boto3.py @@ -1,9 +1,8 @@ -from __future__ import unicode_literals from datetime import datetime from botocore.exceptions import ClientError import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import json from moto.core import ACCOUNT_ID @@ -1177,17 +1176,20 @@ def test_deregister_container_instance(): ], ) - response = ecs_client.start_task( + ecs_client.start_task( cluster="test_ecs_cluster", taskDefinition="test_ecs_task", overrides={}, containerInstances=[container_instance_id], startedBy="moto", ) - with pytest.raises(Exception) as e: + with pytest.raises(Exception): ecs_client.deregister_container_instance( cluster=test_cluster_name, containerInstance=container_instance_id - ).should.have.raised(Exception) + ) + # TODO: Return correct error format + # should.contain("Found running tasks on the instance") + container_instances_response = ecs_client.list_container_instances( cluster=test_cluster_name ) @@ -1212,7 +1214,7 @@ def test_list_container_instances(): instance_to_create = 3 test_instance_arns = [] - for i in range(0, instance_to_create): + for _ in range(0, instance_to_create): test_instance = ec2.create_instances( ImageId=EXAMPLE_AMI_ID, MinCount=1, MaxCount=1 )[0] @@ -1245,7 +1247,7 @@ def test_describe_container_instances(): instance_to_create = 3 test_instance_arns = [] - for i in range(0, instance_to_create): + for _ in range(0, instance_to_create): test_instance = ec2.create_instances( ImageId=EXAMPLE_AMI_ID, MinCount=1, MaxCount=1 )[0] @@ -1280,6 +1282,9 @@ def test_describe_container_instances(): ecs_client.describe_container_instances( cluster=test_cluster_name, containerInstances=[] ) + err = e.value.response["Error"] + err["Code"].should.equal("ClientException") + err["Message"].should.equal("Container Instances cannot be empty.") @mock_ecs @@ -1310,7 +1315,7 @@ def test_update_container_instances_state(): instance_to_create = 3 test_instance_arns = [] - for i in range(0, instance_to_create): + for _ in range(0, instance_to_create): test_instance = ec2.create_instances( ImageId=EXAMPLE_AMI_ID, MinCount=1, MaxCount=1 )[0] @@ -1372,7 +1377,7 @@ def test_update_container_instances_state_by_arn(): instance_to_create = 3 test_instance_arns = [] - for i in range(0, instance_to_create): + for _ in range(0, instance_to_create): test_instance = ec2.create_instances( ImageId=EXAMPLE_AMI_ID, MinCount=1, MaxCount=1 )[0] @@ -2371,8 +2376,6 @@ def test_default_container_instance_attributes(): ) response["containerInstance"]["ec2InstanceId"].should.equal(test_instance.id) - full_arn = response["containerInstance"]["containerInstanceArn"] - container_instance_id = full_arn.rsplit("/", 1)[-1] default_attributes = response["containerInstance"]["attributes"] assert len(default_attributes) == 4 diff --git a/tests/test_ecs/test_ecs_cloudformation.py b/tests/test_ecs/test_ecs_cloudformation.py index 3929d587e..d8680b2a9 100644 --- a/tests/test_ecs/test_ecs_cloudformation.py +++ b/tests/test_ecs/test_ecs_cloudformation.py @@ -3,7 +3,7 @@ import json from copy import deepcopy from moto import mock_cloudformation, mock_ecs from moto.core.utils import pascal_to_camelcase, remap_nested_keys -import sure # noqa +import sure # noqa # pylint: disable=unused-import @mock_ecs diff --git a/tests/test_efs/test_file_system.py b/tests/test_efs/test_file_system.py index 15bf1f0e8..48f8199b5 100644 --- a/tests/test_efs/test_file_system.py +++ b/tests/test_efs/test_file_system.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re from os import environ diff --git a/tests/test_efs/test_mount_target.py b/tests/test_efs/test_mount_target.py index 8a5e87444..61ef6b3e4 100644 --- a/tests/test_efs/test_mount_target.py +++ b/tests/test_efs/test_mount_target.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re import sys from os import environ diff --git a/tests/test_efs/test_server.py b/tests/test_efs/test_server.py index 21fa88cc9..b93e700fa 100644 --- a/tests/test_efs/test_server.py +++ b/tests/test_efs/test_server.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import re from os import environ diff --git a/tests/test_eks/test_eks.py b/tests/test_eks/test_eks.py index 40195c2fd..016d49823 100644 --- a/tests/test_eks/test_eks.py +++ b/tests/test_eks/test_eks.py @@ -1,12 +1,10 @@ -from __future__ import unicode_literals - from copy import deepcopy from unittest import SkipTest import boto3 import mock import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from freezegun import freeze_time @@ -598,7 +596,7 @@ def test_create_nodegroup_generates_valid_nodegroup_created_timestamp(NodegroupB def test_create_nodegroup_generates_valid_nodegroup_modified_timestamp( NodegroupBuilder, ): - client, generated_test_data = NodegroupBuilder() + _, generated_test_data = NodegroupBuilder() result_time = iso_8601_datetime_without_milliseconds( generated_test_data.nodegroup_describe_output[NodegroupAttributes.MODIFIED_AT] diff --git a/tests/test_eks/test_server.py b/tests/test_eks/test_server.py index ad739691a..ed0abe1ee 100644 --- a/tests/test_eks/test_server.py +++ b/tests/test_eks/test_server.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import json from copy import deepcopy import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_eks diff --git a/tests/test_elasticbeanstalk/test_eb.py b/tests/test_elasticbeanstalk/test_eb.py index 410f1862b..899f51111 100644 --- a/tests/test_elasticbeanstalk/test_eb.py +++ b/tests/test_elasticbeanstalk/test_eb.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_elasticbeanstalk diff --git a/tests/test_elastictranscoder/test_elastictranscoder.py b/tests/test_elastictranscoder/test_elastictranscoder.py index 3fb036a6f..948a27e3f 100644 --- a/tests/test_elastictranscoder/test_elastictranscoder.py +++ b/tests/test_elastictranscoder/test_elastictranscoder.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - from botocore.exceptions import ClientError import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from moto import mock_elastictranscoder from moto.core import ACCOUNT_ID diff --git a/tests/test_elastictranscoder/test_server.py b/tests/test_elastictranscoder/test_server.py index 3d43cfbf2..bd194a3d0 100644 --- a/tests/test_elastictranscoder/test_server.py +++ b/tests/test_elastictranscoder/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_elastictranscoder diff --git a/tests/test_elb/test_elb.py b/tests/test_elb/test_elb.py index 3497face9..ed72f43f2 100644 --- a/tests/test_elb/test_elb.py +++ b/tests/test_elb/test_elb.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import boto3 import botocore import boto @@ -12,10 +11,9 @@ from boto.ec2.elb.attributes import ( from botocore.exceptions import ClientError from boto.exception import BotoServerError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_acm, mock_elb, mock_ec2, mock_elb_deprecated, mock_ec2_deprecated -from moto.core import ACCOUNT_ID from tests import EXAMPLE_AMI_ID from uuid import uuid4 diff --git a/tests/test_elb/test_elb_cloudformation.py b/tests/test_elb/test_elb_cloudformation.py index 938810206..d74e6fe05 100644 --- a/tests/test_elb/test_elb_cloudformation.py +++ b/tests/test_elb/test_elb_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudformation, mock_ec2, mock_elb from tests import EXAMPLE_AMI_ID diff --git a/tests/test_elb/test_server.py b/tests/test_elb/test_server.py index 0f432cef4..7297205a7 100644 --- a/tests/test_elb/test_server.py +++ b/tests/test_elb/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_elbv2/test_elbv2.py b/tests/test_elbv2/test_elbv2.py index e88517dbd..057784131 100644 --- a/tests/test_elbv2/test_elbv2.py +++ b/tests/test_elbv2/test_elbv2.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals - import os import boto3 import botocore from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_elbv2, mock_ec2, mock_acm from moto.elbv2 import elbv2_backends @@ -16,10 +14,9 @@ from tests import EXAMPLE_AMI_ID @mock_elbv2 @mock_ec2 def test_create_load_balancer(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, security_group, subnet1, subnet2, conn = create_load_balancer() lb = response.get("LoadBalancers")[0] - VPCID = vpc.id lb.get("DNSName").should.equal("my-lb-1.us-east-1.elb.amazonaws.com") lb.get("LoadBalancerArn").should.equal( "arn:aws:elasticloadbalancing:us-east-1:1:loadbalancer/my-lb/50dc6c495c0c9188" @@ -68,7 +65,7 @@ def create_load_balancer(): @mock_elbv2 @mock_ec2 def test_describe_load_balancers(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() response = conn.describe_load_balancers() @@ -94,7 +91,7 @@ def test_describe_load_balancers(): @mock_elbv2 @mock_ec2 def test_add_remove_tags(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + _, _, _, _, _, conn = create_load_balancer() lbs = conn.describe_load_balancers()["LoadBalancers"] lbs.should.have.length_of(1) @@ -217,7 +214,7 @@ def test_create_elb_in_multiple_region(): @mock_elbv2 @mock_ec2 def test_create_listeners_without_port(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") response = conn.create_target_group( Name="a-target", @@ -252,7 +249,7 @@ def test_create_listeners_without_port(): @mock_elbv2 @mock_ec2 def test_create_target_group_and_listeners(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") @@ -369,7 +366,7 @@ def test_create_target_group_and_listeners(): ) response.get("Listeners").should.have.length_of(2) - listener_response = conn.create_rule( + conn.create_rule( ListenerArn=http_listener_arn, Conditions=[{"Field": "path-pattern", "Values": ["/*"]},], Priority=3, @@ -418,7 +415,7 @@ def test_create_target_group_and_listeners(): @mock_elbv2 @mock_ec2 def test_create_target_group_without_non_required_parameters(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() # request without HealthCheckIntervalSeconds parameter # which is default to 30 seconds @@ -440,7 +437,7 @@ def test_create_rule_forward_config_as_second_arg(): # https://github.com/spulec/moto/issues/4123 # Necessary because there was some convoluted way of parsing arguments # Actions with type=forward had to be the first action specified - response, vpc, security_group, subnet1, subnet2, elbv2 = create_load_balancer() + response, vpc, _, _, _, elbv2 = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") @@ -610,7 +607,7 @@ def test_describe_paginated_balancers(): @mock_elbv2 @mock_ec2 def test_delete_load_balancer(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() response.get("LoadBalancers").should.have.length_of(1) lb = response.get("LoadBalancers")[0] @@ -858,7 +855,7 @@ def test_terminated_instance_target(): @mock_ec2 @mock_elbv2 def test_target_group_attributes(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() response = conn.create_target_group( Name="a-target", @@ -951,7 +948,7 @@ def test_create_target_group_invalid_protocol(): @mock_elbv2 @mock_ec2 def test_create_rule_priority_in_use(): - response, vpc, security_group, subnet1, subnet2, elbv2 = create_load_balancer() + response, _, _, _, _, elbv2 = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") @@ -978,7 +975,7 @@ def test_create_rule_priority_in_use(): @mock_elbv2 @mock_ec2 def test_handle_listener_rules(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") @@ -1156,7 +1153,7 @@ def test_handle_listener_rules(): new_host = "new.example.com" new_path_pattern = "new_path" new_pathpatternconfig_pattern = "new_path2" - modified_rule = conn.modify_rule( + conn.modify_rule( RuleArn=first_rule["RuleArn"], Conditions=[ {"Field": "host-header", "Values": [new_host]}, @@ -1193,7 +1190,7 @@ def test_handle_listener_rules(): new_host_2 = "new.examplewebsite.com" new_path_pattern_2 = "new_path_2" new_pathpatternconfig_pattern_2 = "new_path_2" - modified_rule = conn.modify_rule( + conn.modify_rule( RuleArn=third_rule["RuleArn"], Conditions=[ {"Field": "host-header", "Values": [new_host_2]}, @@ -1325,7 +1322,7 @@ def test_handle_listener_rules(): @mock_elbv2 @mock_ec2 def test_describe_invalid_target_group(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() response.get("LoadBalancers")[0].get("LoadBalancerArn") @@ -1352,7 +1349,7 @@ def test_describe_invalid_target_group(): @mock_elbv2 @mock_ec2 def test_describe_target_groups_no_arguments(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, vpc, _, _, _, conn = create_load_balancer() response.get("LoadBalancers")[0].get("LoadBalancerArn") @@ -1408,7 +1405,7 @@ def test_describe_ssl_policies(): @mock_elbv2 @mock_ec2 def test_set_ip_address_type(): - response, vpc, security_group, subnet1, subnet2, client = create_load_balancer() + response, _, security_group, subnet1, subnet2, client = create_load_balancer() arn = response["LoadBalancers"][0]["LoadBalancerArn"] # Internal LBs cant be dualstack yet @@ -1522,7 +1519,7 @@ def test_set_subnets_errors(): @mock_elbv2 @mock_ec2 def test_modify_load_balancer_attributes_idle_timeout(): - response, vpc, security_group, subnet1, subnet2, client = create_load_balancer() + response, _, _, _, _, client = create_load_balancer() arn = response["LoadBalancers"][0]["LoadBalancerArn"] client.modify_load_balancer_attributes( @@ -1647,7 +1644,6 @@ def test_modify_listener_http_to_https(): DomainName="google.com", SubjectAlternativeNames=["google.com", "www.google.com", "mail.google.com"], ) - google_arn = response["CertificateArn"] response = acm.request_certificate( DomainName="yahoo.com", SubjectAlternativeNames=["yahoo.com", "www.yahoo.com", "mail.yahoo.com"], @@ -1709,7 +1705,7 @@ def test_modify_listener_http_to_https(): @mock_elbv2 @mock_ec2 def test_redirect_action_listener_rule(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") action = { @@ -1742,7 +1738,7 @@ def test_redirect_action_listener_rule(): listener.get("DefaultActions").should.equal(expected_default_actions) listener_arn = listener.get("ListenerArn") - listener_response = conn.create_rule( + conn.create_rule( ListenerArn=listener_arn, Conditions=[{"Field": "path-pattern", "Values": ["/*"]},], Priority=3, @@ -1767,7 +1763,7 @@ def test_redirect_action_listener_rule(): @mock_elbv2 @mock_ec2 def test_cognito_action_listener_rule(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") action = { @@ -1791,7 +1787,7 @@ def test_cognito_action_listener_rule(): listener.get("DefaultActions")[0].should.equal(action) listener_arn = listener.get("ListenerArn") - listener_response = conn.create_rule( + conn.create_rule( ListenerArn=listener_arn, Conditions=[{"Field": "path-pattern", "Values": ["/*"]},], Priority=3, @@ -1810,7 +1806,7 @@ def test_cognito_action_listener_rule(): @mock_elbv2 @mock_ec2 def test_fixed_response_action_listener_rule(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") action = { @@ -1832,7 +1828,7 @@ def test_fixed_response_action_listener_rule(): listener.get("DefaultActions")[0].should.equal(action) listener_arn = listener.get("ListenerArn") - listener_response = conn.create_rule( + conn.create_rule( ListenerArn=listener_arn, Conditions=[{"Field": "path-pattern", "Values": ["/*"]},], Priority=3, @@ -1851,7 +1847,7 @@ def test_fixed_response_action_listener_rule(): @mock_elbv2 @mock_ec2 def test_fixed_response_action_listener_rule_validates_status_code(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") invalid_status_code_action = { @@ -1879,7 +1875,7 @@ def test_fixed_response_action_listener_rule_validates_status_code(): @mock_elbv2 @mock_ec2 def test_fixed_response_action_listener_rule_validates_content_type(): - response, vpc, security_group, subnet1, subnet2, conn = create_load_balancer() + response, _, _, _, _, conn = create_load_balancer() load_balancer_arn = response.get("LoadBalancers")[0].get("LoadBalancerArn") invalid_content_type_action = { diff --git a/tests/test_elbv2/test_elbv2_cloudformation.py b/tests/test_elbv2/test_elbv2_cloudformation.py index d2dc21927..11907d5b3 100644 --- a/tests/test_elbv2/test_elbv2_cloudformation.py +++ b/tests/test_elbv2/test_elbv2_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_elbv2, mock_ec2, mock_cloudformation from moto.core import ACCOUNT_ID diff --git a/tests/test_elbv2/test_elbv2_listener_rules.py b/tests/test_elbv2/test_elbv2_listener_rules.py index b98b705a0..fc036c929 100644 --- a/tests/test_elbv2/test_elbv2_listener_rules.py +++ b/tests/test_elbv2/test_elbv2_listener_rules.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals - import boto3 -import botocore from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_elbv2, mock_ec2 @@ -285,7 +282,7 @@ def test_create_rule_validate_condition(condition, expected_message): http_listener_arn = setup_listener(conn) with pytest.raises(ClientError) as ex: - response = conn.create_rule( + conn.create_rule( ListenerArn=http_listener_arn, Priority=100, Conditions=[condition], diff --git a/tests/test_elbv2/test_server.py b/tests/test_elbv2/test_server.py index 7d2ce4b01..e0a93964b 100644 --- a/tests/test_elbv2/test_server.py +++ b/tests/test_elbv2/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_emr/test_emr.py b/tests/test_emr/test_emr.py index 2a58aac5a..9cb12cfa6 100644 --- a/tests/test_emr/test_emr.py +++ b/tests/test_emr/test_emr.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import time from datetime import datetime @@ -8,7 +7,7 @@ from boto.emr.bootstrap_action import BootstrapAction from boto.emr.instance_group import InstanceGroup from boto.emr.step import StreamingStep -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_emr_deprecated from tests.helpers import requires_boto_gte @@ -144,7 +143,7 @@ def test_describe_jobflows(): jobs = conn.describe_jobflows() jobs.should.have.length_of(6) - for cluster_id, y in expected.items(): + for cluster_id in expected: resp = conn.describe_jobflows(jobflow_ids=[cluster_id]) resp.should.have.length_of(1) resp[0].jobflowid.should.equal(cluster_id) diff --git a/tests/test_emr/test_emr_boto3.py b/tests/test_emr/test_emr_boto3.py index 72c2cfd9c..0a7e3f9f4 100644 --- a/tests/test_emr/test_emr_boto3.py +++ b/tests/test_emr/test_emr_boto3.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import time from copy import deepcopy from datetime import datetime @@ -7,7 +6,7 @@ from datetime import datetime import boto3 import json import pytz -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest @@ -191,7 +190,7 @@ def test_describe_cluster_not_found(): conn = boto3.client("emr", region_name="us-east-1") raised = False try: - cluster = conn.describe_cluster(ClusterId="DummyId") + conn.describe_cluster(ClusterId="DummyId") except ClientError as e: if e.response["Error"]["Code"] == "ResourceNotFoundException": raised = True @@ -234,7 +233,7 @@ def test_describe_job_flows(): resp = client.describe_job_flows() resp["JobFlows"].should.have.length_of(6) - for cluster_id, y in expected.items(): + for cluster_id in expected: resp = client.describe_job_flows(JobFlowIds=[cluster_id]) resp["JobFlows"].should.have.length_of(1) resp["JobFlows"][0]["JobFlowId"].should.equal(cluster_id) @@ -556,7 +555,6 @@ def test_run_job_flow_with_instance_groups_with_autoscaling(): @mock_emr def test_put_remove_auto_scaling_policy(): region_name = "us-east-1" - input_groups = dict((g["Name"], g) for g in input_instance_groups) client = boto3.client("emr", region_name=region_name) args = deepcopy(run_job_flow_args) args["Instances"] = {"InstanceGroups": input_instance_groups} diff --git a/tests/test_emr/test_emr_integration.py b/tests/test_emr/test_emr_integration.py index 16b499476..963dfe18d 100644 --- a/tests/test_emr/test_emr_integration.py +++ b/tests/test_emr/test_emr_integration.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import settings from moto.ec2 import mock_ec2, ec2_backend diff --git a/tests/test_emr/test_server.py b/tests/test_emr/test_server.py index 4dbd02553..057d92a53 100644 --- a/tests/test_emr/test_server.py +++ b/tests/test_emr/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_events/test_events.py b/tests/test_events/test_events.py index f2a1e20d9..1887fd3a4 100644 --- a/tests/test_events/test_events.py +++ b/tests/test_events/test_events.py @@ -6,7 +6,7 @@ from datetime import datetime import boto3 import pytest import pytz -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_logs diff --git a/tests/test_events/test_events_cloudformation.py b/tests/test_events/test_events_cloudformation.py index eaa1ce37d..46fcfa76b 100644 --- a/tests/test_events/test_events_cloudformation.py +++ b/tests/test_events/test_events_cloudformation.py @@ -6,7 +6,7 @@ import boto3 import json from botocore.exceptions import ClientError from moto import mock_cloudformation, mock_events -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.core import ACCOUNT_ID @@ -183,6 +183,8 @@ def test_delete_rule(): # then events_client = boto3.client("events", region_name="eu-central-1") - with pytest.raises(ClientError, match="does not exist") as e: - + with pytest.raises(ClientError) as exc: events_client.describe_rule(Name=name) + err = exc.value.response["Error"] + err["Code"].should.equal("ResourceNotFoundException") + err["Message"].should.equal("Rule test-rule does not exist.") diff --git a/tests/test_events/test_events_integration.py b/tests/test_events/test_events_integration.py index 73f82ec69..d56626b08 100644 --- a/tests/test_events/test_events_integration.py +++ b/tests/test_events/test_events_integration.py @@ -2,7 +2,7 @@ import json from datetime import datetime import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_events, mock_sqs, mock_logs from moto.core import ACCOUNT_ID diff --git a/tests/test_firehose/test_firehose_destination_types.py b/tests/test_firehose/test_firehose_destination_types.py index ac07d6994..96c587768 100644 --- a/tests/test_firehose/test_firehose_destination_types.py +++ b/tests/test_firehose/test_firehose_destination_types.py @@ -1,5 +1,6 @@ """Unit tests verifying various delivery stream destination content.""" import boto3 +import sure # noqa # pylint: disable=unused-import from moto import mock_firehose from moto import settings diff --git a/tests/test_forecast/test_forecast.py b/tests/test_forecast/test_forecast.py index 7936a500d..99c684889 100644 --- a/tests/test_forecast/test_forecast.py +++ b/tests/test_forecast/test_forecast.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_forecast from moto.core import ACCOUNT_ID @@ -78,8 +76,8 @@ def test_forecast_dataset_group_create_duplicate_fails(): def test_forecast_dataset_group_list_default_empty(): client = boto3.client("forecast", region_name=region) - list = client.list_dataset_groups() - list["DatasetGroups"].should.be.empty + resp = client.list_dataset_groups() + resp["DatasetGroups"].should.be.empty @mock_forecast diff --git a/tests/test_glacier/test_glacier_archives.py b/tests/test_glacier/test_glacier_archives.py index e99d785de..0f884059e 100644 --- a/tests/test_glacier/test_glacier_archives.py +++ b/tests/test_glacier/test_glacier_archives.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - from tempfile import NamedTemporaryFile import boto3 import boto.glacier -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from moto import mock_glacier_deprecated, mock_glacier diff --git a/tests/test_glacier/test_glacier_jobs.py b/tests/test_glacier/test_glacier_jobs.py index 9f08ac2ea..b8645c14c 100644 --- a/tests/test_glacier/test_glacier_jobs.py +++ b/tests/test_glacier/test_glacier_jobs.py @@ -1,11 +1,8 @@ -from __future__ import unicode_literals - import boto3 import json -import time from boto.glacier.layer1 import Layer1 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import time from moto import mock_glacier_deprecated, mock_glacier diff --git a/tests/test_glacier/test_glacier_vaults.py b/tests/test_glacier/test_glacier_vaults.py index 6c5e89227..f8d7d6751 100644 --- a/tests/test_glacier/test_glacier_vaults.py +++ b/tests/test_glacier/test_glacier_vaults.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - import boto.glacier import boto3 +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_glacier_deprecated, mock_glacier from moto.core import ACCOUNT_ID diff --git a/tests/test_glacier/test_server.py b/tests/test_glacier/test_server.py index d43dd4e8a..d78a24d71 100644 --- a/tests/test_glacier/test_server.py +++ b/tests/test_glacier/test_server.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_glacier diff --git a/tests/test_glue/__init__.py b/tests/test_glue/__init__.py index 78b780d97..e69de29bb 100644 --- a/tests/test_glue/__init__.py +++ b/tests/test_glue/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_glue/fixtures/__init__.py b/tests/test_glue/fixtures/__init__.py index 78b780d97..e69de29bb 100644 --- a/tests/test_glue/fixtures/__init__.py +++ b/tests/test_glue/fixtures/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_glue/fixtures/datacatalog.py b/tests/test_glue/fixtures/datacatalog.py index 9e5d8d229..6999377ea 100644 --- a/tests/test_glue/fixtures/datacatalog.py +++ b/tests/test_glue/fixtures/datacatalog.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - TABLE_INPUT = { "Owner": "a_fake_owner", "Parameters": {"EXTERNAL": "TRUE"}, diff --git a/tests/test_glue/helpers.py b/tests/test_glue/helpers.py index 5dc944fa9..89e1a0b89 100644 --- a/tests/test_glue/helpers.py +++ b/tests/test_glue/helpers.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import copy from .fixtures.datacatalog import TABLE_INPUT, PARTITION_INPUT, DATABASE_INPUT @@ -24,11 +22,11 @@ def get_database(client, database_name): return client.get_database(Name=database_name) -def create_table_input(database_name, table_name, columns=[], partition_keys=[]): +def create_table_input(database_name, table_name, columns=None, partition_keys=None): table_input = copy.deepcopy(TABLE_INPUT) table_input["Name"] = table_name - table_input["PartitionKeys"] = partition_keys - table_input["StorageDescriptor"]["Columns"] = columns + table_input["PartitionKeys"] = partition_keys or [] + table_input["StorageDescriptor"]["Columns"] = columns or [] table_input["StorageDescriptor"][ "Location" ] = "s3://my-bucket/{database_name}/{table_name}".format( @@ -69,14 +67,14 @@ def get_table_version(client, database_name, table_name, version_id): ) -def create_partition_input(database_name, table_name, values=[], columns=[]): +def create_partition_input(database_name, table_name, values=None, columns=None): root_path = "s3://my-bucket/{database_name}/{table_name}".format( database_name=database_name, table_name=table_name ) part_input = copy.deepcopy(PARTITION_INPUT) - part_input["Values"] = values - part_input["StorageDescriptor"]["Columns"] = columns + part_input["Values"] = values or [] + part_input["StorageDescriptor"]["Columns"] = columns or [] part_input["StorageDescriptor"]["SerdeInfo"]["Parameters"]["path"] = root_path return part_input @@ -90,7 +88,7 @@ def create_partition(client, database_name, table_name, partiton_input=None, **k def update_partition( - client, database_name, table_name, old_values=[], partiton_input=None, **kwargs + client, database_name, table_name, old_values=None, partiton_input=None, **kwargs ): if partiton_input is None: partiton_input = create_partition_input(database_name, table_name, **kwargs) @@ -98,7 +96,7 @@ def update_partition( DatabaseName=database_name, TableName=table_name, PartitionInput=partiton_input, - PartitionValueList=old_values, + PartitionValueList=old_values or [], ) diff --git a/tests/test_glue/test_datacatalog.py b/tests/test_glue/test_datacatalog.py index 43a2ae380..86737a578 100644 --- a/tests/test_glue/test_datacatalog.py +++ b/tests/test_glue/test_datacatalog.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import re import pytest import json diff --git a/tests/test_iam/test_iam.py b/tests/test_iam/test_iam.py index eb6627df9..faf0cfcda 100644 --- a/tests/test_iam/test_iam.py +++ b/tests/test_iam/test_iam.py @@ -1,11 +1,10 @@ -from __future__ import unicode_literals import base64 import json import boto import boto3 import csv -import sure # noqa +import sure # pylint: disable=unused-import from boto.exception import BotoServerError from botocore.exceptions import ClientError @@ -310,7 +309,7 @@ def test_delete_instance_profile(): ) conn.delete_instance_profile(InstanceProfileName="my-profile") with pytest.raises(conn.exceptions.NoSuchEntityException): - profile = conn.get_instance_profile(InstanceProfileName="my-profile") + conn.get_instance_profile(InstanceProfileName="my-profile") @mock_iam() @@ -648,13 +647,9 @@ def test_create_policy(): @mock_iam def test_create_policy_already_exists(): conn = boto3.client("iam", region_name="us-east-1") - response = conn.create_policy( - PolicyName="TestCreatePolicy", PolicyDocument=MOCK_POLICY - ) + conn.create_policy(PolicyName="TestCreatePolicy", PolicyDocument=MOCK_POLICY) with pytest.raises(conn.exceptions.EntityAlreadyExistsException) as ex: - response = conn.create_policy( - PolicyName="TestCreatePolicy", PolicyDocument=MOCK_POLICY - ) + conn.create_policy(PolicyName="TestCreatePolicy", PolicyDocument=MOCK_POLICY) ex.value.response["Error"]["Code"].should.equal("EntityAlreadyExists") ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(409) ex.value.response["Error"]["Message"].should.contain("TestCreatePolicy") @@ -815,9 +810,7 @@ def test_set_default_policy_version(): @mock_iam def test_get_policy(): conn = boto3.client("iam", region_name="us-east-1") - response = conn.create_policy( - PolicyName="TestGetPolicy", PolicyDocument=MOCK_POLICY - ) + conn.create_policy(PolicyName="TestGetPolicy", PolicyDocument=MOCK_POLICY) policy = conn.get_policy( PolicyArn="arn:aws:iam::{}:policy/TestGetPolicy".format(ACCOUNT_ID) ) @@ -2884,7 +2877,7 @@ def test_create_role_with_same_name_should_fail(): def test_create_policy_with_same_name_should_fail(): iam = boto3.client("iam", region_name="us-east-1") test_policy_name = str(uuid4()) - policy = iam.create_policy(PolicyName=test_policy_name, PolicyDocument=MOCK_POLICY) + iam.create_policy(PolicyName=test_policy_name, PolicyDocument=MOCK_POLICY) # Create the role again, and verify that it fails with pytest.raises(ClientError) as err: iam.create_policy(PolicyName=test_policy_name, PolicyDocument=MOCK_POLICY) @@ -3384,7 +3377,6 @@ def test_delete_account_password_policy_errors(): @mock_iam def test_role_list_config_discovered_resources(): from moto.iam.config import role_config_query - from moto.iam.utils import random_resource_id # Without any roles assert role_config_query.list_config_service_resources(None, None, 100, None) == ( @@ -3720,7 +3712,6 @@ def test_role_config_dict(): @mock_iam @mock_config def test_role_config_client(): - from moto.iam.models import ACCOUNT_ID from moto.iam.utils import random_resource_id CONFIG_REGIONS = boto3.Session().get_available_regions("config") @@ -3960,7 +3951,6 @@ def test_role_config_client(): @mock_iam def test_policy_list_config_discovered_resources(): from moto.iam.config import policy_config_query - from moto.iam.utils import random_policy_id # Without any policies assert policy_config_query.list_config_service_resources(None, None, 100, None) == ( @@ -4145,7 +4135,6 @@ def test_policy_config_dict(): @mock_iam @mock_config def test_policy_config_client(): - from moto.iam.models import ACCOUNT_ID from moto.iam.utils import random_policy_id CONFIG_REGIONS = boto3.Session().get_available_regions("config") diff --git a/tests/test_iam/test_iam_account_aliases.py b/tests/test_iam/test_iam_account_aliases.py index d01a72106..7ae0d94de 100644 --- a/tests/test_iam/test_iam_account_aliases.py +++ b/tests/test_iam/test_iam_account_aliases.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # pylint: disable=unused-import from moto import mock_iam diff --git a/tests/test_iam/test_iam_cloudformation.py b/tests/test_iam/test_iam_cloudformation.py index e8fe5f3f7..e6303b218 100644 --- a/tests/test_iam/test_iam_cloudformation.py +++ b/tests/test_iam/test_iam_cloudformation.py @@ -1,7 +1,7 @@ import boto3 import json import yaml -import sure # noqa +import sure # pylint: disable=unused-import import pytest from botocore.exceptions import ClientError @@ -257,12 +257,12 @@ Resources: cf_client.create_stack(StackName=stack_name, TemplateBody=template) iam_client = boto3.client("iam", region_name="us-east-1") - user = iam_client.get_user(UserName=user_name) + iam_client.get_user(UserName=user_name) cf_client.delete_stack(StackName=stack_name) with pytest.raises(ClientError) as e: - user = iam_client.get_user(UserName=user_name) + iam_client.get_user(UserName=user_name) e.value.response["Error"]["Code"].should.equal("NoSuchEntity") @@ -287,12 +287,12 @@ Resources: user_name = provisioned_resource["PhysicalResourceId"] iam_client = boto3.client("iam", region_name="us-east-1") - user = iam_client.get_user(UserName=user_name) + iam_client.get_user(UserName=user_name) cf_client.delete_stack(StackName=stack_name) with pytest.raises(ClientError) as e: - user = iam_client.get_user(UserName=user_name) + iam_client.get_user(UserName=user_name) e.value.response["Error"]["Code"].should.equal("NoSuchEntity") @@ -587,7 +587,7 @@ def test_iam_cloudformation_create_user_policy(): s3_client = boto3.client("s3", region_name="us-east-1") bucket_name = "my-bucket" - bucket = s3_client.create_bucket(Bucket=bucket_name) + s3_client.create_bucket(Bucket=bucket_name) bucket_arn = "arn:aws:s3:::{0}".format(bucket_name) cf_client = boto3.client("cloudformation", region_name="us-east-1") @@ -726,7 +726,7 @@ def test_iam_cloudformation_delete_user_policy_having_generated_name(): s3_client = boto3.client("s3", region_name="us-east-1") bucket_name = "my-bucket" - bucket = s3_client.create_bucket(Bucket=bucket_name) + s3_client.create_bucket(Bucket=bucket_name) bucket_arn = "arn:aws:s3:::{0}".format(bucket_name) cf_client = boto3.client("cloudformation", region_name="us-east-1") @@ -1356,7 +1356,7 @@ Resources: access_key_id = provisioned_access_key["PhysicalResourceId"] iam_client = boto3.client("iam", region_name="us-east-1") - user = iam_client.get_user(UserName=user_name) + iam_client.get_user(UserName=user_name) access_keys = iam_client.list_access_keys(UserName=user_name) access_key_id.should.equal(access_keys["AccessKeyMetadata"][0]["AccessKeyId"]) @@ -1413,7 +1413,7 @@ Resources: access_key_id = provisioned_access_key["PhysicalResourceId"] iam_client = boto3.client("iam", region_name="us-east-1") - user = iam_client.get_user(UserName=user_name) + iam_client.get_user(UserName=user_name) access_keys = iam_client.list_access_keys(UserName=user_name) access_key_id.should.equal(access_keys["AccessKeyMetadata"][0]["AccessKeyId"]) @@ -1456,7 +1456,6 @@ def test_iam_cloudformation_create_role(): ] role = [res for res in resources if res["ResourceType"] == "AWS::IAM::Role"][0] role["LogicalResourceId"].should.equal("RootRole") - role_name = role["PhysicalResourceId"] iam_client = boto3.client("iam", region_name="us-east-1") iam_client.list_roles()["Roles"].should.have.length_of(1) diff --git a/tests/test_iam/test_iam_groups.py b/tests/test_iam/test_iam_groups.py index 1f4e8b5be..077c93920 100644 --- a/tests/test_iam/test_iam_groups.py +++ b/tests/test_iam/test_iam_groups.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals - from datetime import datetime import boto import boto3 +import sure # noqa # pylint: disable=unused-import import json -import sure # noqa import pytest from boto.exception import BotoServerError diff --git a/tests/test_iam/test_iam_policies.py b/tests/test_iam/test_iam_policies.py index 96cd632c6..305906aca 100644 --- a/tests/test_iam/test_iam_policies.py +++ b/tests/test_iam/test_iam_policies.py @@ -3,7 +3,7 @@ import json import boto3 from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # pylint: disable=unused-import from moto import mock_iam diff --git a/tests/test_iam/test_iam_server_certificates.py b/tests/test_iam/test_iam_server_certificates.py index f77956e5e..065f31982 100644 --- a/tests/test_iam/test_iam_server_certificates.py +++ b/tests/test_iam/test_iam_server_certificates.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from datetime import datetime diff --git a/tests/test_iam/test_server.py b/tests/test_iam/test_server.py index 4d1698424..f3906aded 100644 --- a/tests/test_iam/test_server.py +++ b/tests/test_iam/test_server.py @@ -1,9 +1,5 @@ -from __future__ import unicode_literals - -import json - import re -import sure # noqa +import sure # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_iot/test_iot.py b/tests/test_iot/test_iot.py index ac77bdaa6..84eac7f03 100644 --- a/tests/test_iot/test_iot.py +++ b/tests/test_iot/test_iot.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import boto3 from moto import mock_iot @@ -890,7 +888,7 @@ def test_principal_policy_deprecated(): def test_principal_thing(): client = boto3.client("iot", region_name="ap-northeast-1") thing_name = "my-thing" - thing = client.create_thing(thingName=thing_name) + client.create_thing(thingName=thing_name) cert = client.create_keys_and_certificate(setAsActive=True) cert_arn = cert["certificateArn"] @@ -923,7 +921,7 @@ def test_principal_thing(): def test_delete_principal_thing(): client = boto3.client("iot", region_name="ap-northeast-1") thing_name = "my-thing" - thing = client.create_thing(thingName=thing_name) + client.create_thing(thingName=thing_name) cert = client.create_keys_and_certificate(setAsActive=True) cert_arn = cert["certificateArn"] cert_id = cert["certificateId"] @@ -959,7 +957,7 @@ class TestListThingGroup: def test_should_list_all_groups(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups() resp.should.have.key("thingGroups") @@ -969,7 +967,7 @@ class TestListThingGroup: def test_should_list_all_groups_non_recursively(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups(recursive=False) resp.should.have.key("thingGroups") @@ -979,7 +977,7 @@ class TestListThingGroup: def test_should_list_all_groups_filtered_by_parent(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups(parentGroup=self.group_name_1a) resp.should.have.key("thingGroups") @@ -998,7 +996,7 @@ class TestListThingGroup: def test_should_list_all_groups_filtered_by_parent_non_recursively(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups(parentGroup=self.group_name_1a, recursive=False) resp.should.have.key("thingGroups") @@ -1011,7 +1009,7 @@ class TestListThingGroup: def test_should_list_all_groups_filtered_by_name_prefix(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups(namePrefixFilter="my-group-name-1") resp.should.have.key("thingGroups") @@ -1027,7 +1025,7 @@ class TestListThingGroup: def test_should_list_all_groups_filtered_by_name_prefix_non_recursively(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups( namePrefixFilter="my-group-name-1", recursive=False @@ -1044,7 +1042,7 @@ class TestListThingGroup: def test_should_list_all_groups_filtered_by_name_prefix_and_parent(self): # setup client = boto3.client("iot", region_name="ap-northeast-1") - group_catalog = generate_thing_group_tree(client, self.tree_dict) + generate_thing_group_tree(client, self.tree_dict) # test resp = client.list_thing_groups( namePrefixFilter="my-group-name-2", parentGroup=self.group_name_1a @@ -1072,7 +1070,7 @@ def test_delete_thing_group(): tree_dict = { group_name_1a: {group_name_2a: {},}, } - group_catalog = generate_thing_group_tree(client, tree_dict) + generate_thing_group_tree(client, tree_dict) # delete group with child try: diff --git a/tests/test_iot/test_server.py b/tests/test_iot/test_server.py index f788d2350..460eac1a7 100644 --- a/tests/test_iot/test_server.py +++ b/tests/test_iot/test_server.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import json from urllib.parse import quote import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_iot diff --git a/tests/test_iotdata/test_iotdata.py b/tests/test_iotdata/test_iotdata.py index b709a0db5..4a2cdd838 100644 --- a/tests/test_iotdata/test_iotdata.py +++ b/tests/test_iotdata/test_iotdata.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import json import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from botocore.exceptions import ClientError from moto import mock_iotdata, mock_iot diff --git a/tests/test_iotdata/test_server.py b/tests/test_iotdata/test_server.py index b87d888e5..6398cf5b6 100644 --- a/tests/test_iotdata/test_server.py +++ b/tests/test_iotdata/test_server.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - from urllib.parse import quote import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_iotdata diff --git a/tests/test_kinesis/test_kinesis.py b/tests/test_kinesis/test_kinesis.py index 2a8c0fc6d..98f2834e4 100644 --- a/tests/test_kinesis/test_kinesis.py +++ b/tests/test_kinesis/test_kinesis.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime import time import pytest @@ -14,7 +12,7 @@ from dateutil.tz import tzlocal from moto import mock_kinesis, mock_kinesis_deprecated from moto.core import ACCOUNT_ID -import sure # noqa +import sure # noqa # pylint: disable=unused-import # Has boto3 equivalent diff --git a/tests/test_kinesis/test_kinesis_boto3.py b/tests/test_kinesis/test_kinesis_boto3.py index b687a1264..8675af5fe 100644 --- a/tests/test_kinesis/test_kinesis_boto3.py +++ b/tests/test_kinesis/test_kinesis_boto3.py @@ -2,7 +2,7 @@ import boto3 from moto import mock_kinesis -import sure # noqa +import sure # noqa # pylint: disable=unused-import @mock_kinesis diff --git a/tests/test_kinesis/test_kinesis_cloudformation.py b/tests/test_kinesis/test_kinesis_cloudformation.py index 59f73b888..7c2eaf0b9 100644 --- a/tests/test_kinesis/test_kinesis_cloudformation.py +++ b/tests/test_kinesis/test_kinesis_cloudformation.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_kinesis, mock_cloudformation diff --git a/tests/test_kinesis/test_server.py b/tests/test_kinesis/test_server.py index 3d7fdeee4..04d38230b 100644 --- a/tests/test_kinesis/test_server.py +++ b/tests/test_kinesis/test_server.py @@ -1,15 +1,9 @@ -from __future__ import unicode_literals - import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_kinesis -""" -Test the different server responses -""" - @mock_kinesis def test_list_streams(): diff --git a/tests/test_kinesisvideo/test_kinesisvideo.py b/tests/test_kinesisvideo/test_kinesisvideo.py index abd63bbda..24e762cc9 100644 --- a/tests/test_kinesisvideo/test_kinesisvideo.py +++ b/tests/test_kinesisvideo/test_kinesisvideo.py @@ -1,11 +1,8 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from moto import mock_kinesisvideo from botocore.exceptions import ClientError -import json @mock_kinesisvideo diff --git a/tests/test_kinesisvideo/test_server.py b/tests/test_kinesisvideo/test_server.py index 20301353f..905fc18ea 100644 --- a/tests/test_kinesisvideo/test_server.py +++ b/tests/test_kinesisvideo/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_kinesisvideo diff --git a/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py b/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py index 6121ba843..f4b94952a 100644 --- a/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py +++ b/tests/test_kinesisvideoarchivedmedia/test_kinesisvideoarchivedmedia.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_kinesisvideoarchivedmedia from moto import mock_kinesisvideo from datetime import datetime, timedelta diff --git a/tests/test_kinesisvideoarchivedmedia/test_server.py b/tests/test_kinesisvideoarchivedmedia/test_server.py index 482c7bb1b..d05a884b2 100644 --- a/tests/test_kinesisvideoarchivedmedia/test_server.py +++ b/tests/test_kinesisvideoarchivedmedia/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_kinesisvideoarchivedmedia diff --git a/tests/test_kms/test_kms.py b/tests/test_kms/test_kms.py index e012bfeaf..8820fa26d 100644 --- a/tests/test_kms/test_kms.py +++ b/tests/test_kms/test_kms.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals import base64 import re import boto.kms import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto.exception import JSONResponseError from boto.kms.exceptions import AlreadyExistsException, NotFoundException import pytest @@ -552,7 +551,7 @@ def test__delete_alias(): # added another alias here to make sure that the deletion of the alias can # be done when there are multiple existing aliases. - another_create_resp = kms.create_key() + kms.create_key() another_key_id = create_resp["KeyMetadata"]["KeyId"] another_alias = "alias/another-alias" diff --git a/tests/test_kms/test_kms_boto3.py b/tests/test_kms/test_kms_boto3.py index 79a7f2ad6..e651e4167 100644 --- a/tests/test_kms/test_kms_boto3.py +++ b/tests/test_kms/test_kms_boto3.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import json from datetime import datetime from dateutil.tz import tzutc @@ -9,8 +6,8 @@ import os import boto3 import botocore.exceptions +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError -import sure # noqa from freezegun import freeze_time import pytest @@ -849,7 +846,7 @@ def test_put_key_policy(id_or_arn): key = client.create_key(Description="key1", Policy="initial policy") key_id = key["KeyMetadata"][id_or_arn] - r = client.put_key_policy(KeyId=key_id, PolicyName="default", Policy="policy 2.0") + client.put_key_policy(KeyId=key_id, PolicyName="default", Policy="policy 2.0") response = client.get_key_policy(KeyId=key_id, PolicyName="default") response["Policy"].should.equal("policy 2.0") diff --git a/tests/test_kms/test_server.py b/tests/test_kms/test_server.py index 083f9d18a..33b4d8984 100644 --- a/tests/test_kms/test_server.py +++ b/tests/test_kms/test_server.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_kms diff --git a/tests/test_kms/test_utils.py b/tests/test_kms/test_utils.py index 92d85610e..0de0d9457 100644 --- a/tests/test_kms/test_utils.py +++ b/tests/test_kms/test_utils.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest from moto.kms.exceptions import ( diff --git a/tests/test_logs/test_integration.py b/tests/test_logs/test_integration.py index bdcffe3f6..2ef64f172 100644 --- a/tests/test_logs/test_integration.py +++ b/tests/test_logs/test_integration.py @@ -1,6 +1,7 @@ import base64 from io import BytesIO import json +import sure # noqa # pylint: disable=unused-import import time from zipfile import ZipFile, ZIP_DEFLATED import zlib @@ -9,7 +10,6 @@ import boto3 from botocore.exceptions import ClientError from moto import mock_logs, mock_lambda, mock_iam, mock_firehose, mock_s3 import pytest -import sure # noqa @mock_lambda @@ -48,14 +48,14 @@ def test_put_subscription_filter_update(): # then response = client_logs.describe_subscription_filters(logGroupName=log_group_name) response["subscriptionFilters"].should.have.length_of(1) - filter = response["subscriptionFilters"][0] - creation_time = filter["creationTime"] + sub_filter = response["subscriptionFilters"][0] + creation_time = sub_filter["creationTime"] creation_time.should.be.a(int) - filter["destinationArn"] = "arn:aws:lambda:us-east-1:123456789012:function:test" - filter["distribution"] = "ByLogStream" - filter["logGroupName"] = "/test" - filter["filterName"] = "test" - filter["filterPattern"] = "" + sub_filter["destinationArn"] = "arn:aws:lambda:us-east-1:123456789012:function:test" + sub_filter["distribution"] = "ByLogStream" + sub_filter["logGroupName"] = "/test" + sub_filter["filterName"] = "test" + sub_filter["filterPattern"] = "" # when # to update an existing subscription filter the 'filerName' must be identical @@ -69,13 +69,13 @@ def test_put_subscription_filter_update(): # then response = client_logs.describe_subscription_filters(logGroupName=log_group_name) response["subscriptionFilters"].should.have.length_of(1) - filter = response["subscriptionFilters"][0] - filter["creationTime"].should.equal(creation_time) - filter["destinationArn"] = "arn:aws:lambda:us-east-1:123456789012:function:test" - filter["distribution"] = "ByLogStream" - filter["logGroupName"] = "/test" - filter["filterName"] = "test" - filter["filterPattern"] = "[]" + sub_filter = response["subscriptionFilters"][0] + sub_filter["creationTime"].should.equal(creation_time) + sub_filter["destinationArn"] = "arn:aws:lambda:us-east-1:123456789012:function:test" + sub_filter["distribution"] = "ByLogStream" + sub_filter["logGroupName"] = "/test" + sub_filter["filterName"] = "test" + sub_filter["filterPattern"] = "[]" # when # only one subscription filter can be associated with a log group @@ -132,13 +132,13 @@ def test_put_subscription_filter_with_lambda(): # then response = client_logs.describe_subscription_filters(logGroupName=log_group_name) response["subscriptionFilters"].should.have.length_of(1) - filter = response["subscriptionFilters"][0] - filter["creationTime"].should.be.a(int) - filter["destinationArn"] = "arn:aws:lambda:us-east-1:123456789012:function:test" - filter["distribution"] = "ByLogStream" - filter["logGroupName"] = "/test" - filter["filterName"] = "test" - filter["filterPattern"] = "" + sub_filter = response["subscriptionFilters"][0] + sub_filter["creationTime"].should.be.a(int) + sub_filter["destinationArn"] = "arn:aws:lambda:us-east-1:123456789012:function:test" + sub_filter["distribution"] = "ByLogStream" + sub_filter["logGroupName"] = "/test" + sub_filter["filterName"] = "test" + sub_filter["filterPattern"] = "" # when client_logs.put_log_events( @@ -224,13 +224,13 @@ def test_put_subscription_filter_with_firehose(): # then response = client_logs.describe_subscription_filters(logGroupName=log_group_name) response["subscriptionFilters"].should.have.length_of(1) - filter = response["subscriptionFilters"][0] - filter["creationTime"].should.be.a(int) - filter["destinationArn"] = firehose_arn - filter["distribution"] = "ByLogStream" - filter["logGroupName"] = "/firehose-test" - filter["filterName"] = "firehose-test" - filter["filterPattern"] = "" + _filter = response["subscriptionFilters"][0] + _filter["creationTime"].should.be.a(int) + _filter["destinationArn"] = firehose_arn + _filter["distribution"] = "ByLogStream" + _filter["logGroupName"] = "/firehose-test" + _filter["filterName"] = "firehose-test" + _filter["filterPattern"] = "" # when client_logs.put_log_events( diff --git a/tests/test_logs/test_logs.py b/tests/test_logs/test_logs.py index df5fd69f9..d4b8cc627 100644 --- a/tests/test_logs/test_logs.py +++ b/tests/test_logs/test_logs.py @@ -1,7 +1,7 @@ import json import os import time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from unittest import SkipTest from datetime import timedelta diff --git a/tests/test_logs/test_models.py b/tests/test_logs/test_models.py index 23fe5baf7..5f8a6a1e3 100644 --- a/tests/test_logs/test_models.py +++ b/tests/test_logs/test_models.py @@ -1,4 +1,4 @@ -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.logs.models import LogGroup diff --git a/tests/test_managedblockchain/__init__.py b/tests/test_managedblockchain/__init__.py index baffc4882..e69de29bb 100644 --- a/tests/test_managedblockchain/__init__.py +++ b/tests/test_managedblockchain/__init__.py @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/tests/test_managedblockchain/helpers.py b/tests/test_managedblockchain/helpers.py index f8c6d29b9..91a79732f 100644 --- a/tests/test_managedblockchain/helpers.py +++ b/tests/test_managedblockchain/helpers.py @@ -1,6 +1,3 @@ -from __future__ import unicode_literals - - default_frameworkconfiguration = {"Fabric": {"Edition": "STARTER"}} default_votingpolicy = { diff --git a/tests/test_managedblockchain/test_managedblockchain_invitations.py b/tests/test_managedblockchain/test_managedblockchain_invitations.py index 6079f1e8d..16e6a0bae 100644 --- a/tests/test_managedblockchain/test_managedblockchain_invitations.py +++ b/tests/test_managedblockchain/test_managedblockchain_invitations.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_managedblockchain diff --git a/tests/test_managedblockchain/test_managedblockchain_members.py b/tests/test_managedblockchain/test_managedblockchain_members.py index 69ec2e58c..f8c99c0f5 100644 --- a/tests/test_managedblockchain/test_managedblockchain_members.py +++ b/tests/test_managedblockchain/test_managedblockchain_members.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError, ParamValidationError from moto import mock_managedblockchain diff --git a/tests/test_managedblockchain/test_managedblockchain_networks.py b/tests/test_managedblockchain/test_managedblockchain_networks.py index 385ef1f51..75f9ffd5d 100644 --- a/tests/test_managedblockchain/test_managedblockchain_networks.py +++ b/tests/test_managedblockchain/test_managedblockchain_networks.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_managedblockchain diff --git a/tests/test_managedblockchain/test_managedblockchain_nodes.py b/tests/test_managedblockchain/test_managedblockchain_nodes.py index 0c05ddf64..a8bb99f19 100644 --- a/tests/test_managedblockchain/test_managedblockchain_nodes.py +++ b/tests/test_managedblockchain/test_managedblockchain_nodes.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_managedblockchain diff --git a/tests/test_managedblockchain/test_managedblockchain_proposals.py b/tests/test_managedblockchain/test_managedblockchain_proposals.py index ca4ee38b7..27533a854 100644 --- a/tests/test_managedblockchain/test_managedblockchain_proposals.py +++ b/tests/test_managedblockchain/test_managedblockchain_proposals.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_managedblockchain diff --git a/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py b/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py index 4ec49897e..ef38ef5d1 100644 --- a/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py +++ b/tests/test_managedblockchain/test_managedblockchain_proposalvotes.py @@ -1,15 +1,13 @@ -from __future__ import unicode_literals - import os import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from freezegun import freeze_time from unittest import SkipTest -from moto import mock_managedblockchain, settings +from moto import mock_managedblockchain from . import helpers @@ -695,7 +693,6 @@ def test_list_proposal_votes_badproposal(): MemberConfiguration=helpers.default_memberconfiguration, ) network_id = response["NetworkId"] - member_id = response["MemberId"] with pytest.raises(ClientError) as ex: conn.list_proposal_votes( diff --git a/tests/test_mediaconnect/test_mediaconnect.py b/tests/test_mediaconnect/test_mediaconnect.py index 55c85462b..e49a13301 100644 --- a/tests/test_mediaconnect/test_mediaconnect.py +++ b/tests/test_mediaconnect/test_mediaconnect.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_mediaconnect diff --git a/tests/test_mediaconnect/test_server.py b/tests/test_mediaconnect/test_server.py index 86b27b886..7e70e1548 100644 --- a/tests/test_mediaconnect/test_server.py +++ b/tests/test_mediaconnect/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_mediaconnect diff --git a/tests/test_medialive/test_medialive.py b/tests/test_medialive/test_medialive.py index c61dbf0f9..84d9e3d3e 100644 --- a/tests/test_medialive/test_medialive.py +++ b/tests/test_medialive/test_medialive.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_medialive from uuid import uuid4 @@ -215,7 +213,7 @@ def test_stop_channel_succeeds(): create_response = client.create_channel(**channel_config) channel_id = create_response["Channel"]["Id"] assert len(channel_id) > 1 - start_response = client.start_channel(ChannelId=channel_id) + client.start_channel(ChannelId=channel_id) stop_response = client.stop_channel(ChannelId=channel_id) stop_response["Name"].should.equal(channel_name) stop_response["State"].should.equal("STOPPING") @@ -297,9 +295,9 @@ def test_describe_input_succeeds(): def test_list_inputs_succeeds(): client = boto3.client("medialive", region_name=region) input_config1 = _create_input_config("Input One") - create_response = client.create_input(**input_config1) + client.create_input(**input_config1) input_config2 = _create_input_config("Input Two") - create_response = client.create_input(**input_config2) + client.create_input(**input_config2) response = client.list_inputs() len(response["Inputs"]).should.equal(2) diff --git a/tests/test_medialive/test_server.py b/tests/test_medialive/test_server.py index 0e4c649b1..6ebe6ebad 100644 --- a/tests/test_medialive/test_server.py +++ b/tests/test_medialive/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_medialive diff --git a/tests/test_mediapackage/test_mediapackage.py b/tests/test_mediapackage/test_mediapackage.py index 0c776a9cc..039498a0e 100644 --- a/tests/test_mediapackage/test_mediapackage.py +++ b/tests/test_mediapackage/test_mediapackage.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError # Boto3 will always throw this exception from moto import mock_mediapackage @@ -11,10 +9,10 @@ region = "eu-west-1" def _create_channel_config(**kwargs): - id = kwargs.get("id", "channel-id") + channel_id = kwargs.get("id", "channel-id") description = kwargs.get("description", "Awesome channel!") tags = kwargs.get("tags", {"Customer": "moto"}) - channel_config = dict(Description=description, Id=id, Tags=tags) + channel_config = dict(Description=description, Id=channel_id, Tags=tags) return channel_config @@ -28,7 +26,7 @@ def _create_origin_endpoint_config(**kwargs): dash_package = kwargs.get("dash_package", {"AdTriggers": []}) description = kwargs.get("description", "channel-description") hls_package = kwargs.get("hls_package", {"AdMarkers": "NONE"}) - id = kwargs.get("id", "origin-endpoint-id") + endpoint_id = kwargs.get("id", "origin-endpoint-id") manifest_name = kwargs.get("manifest_name", "manifest-name") mss_package = kwargs.get("mss_package", {"ManifestWindowSeconds": 1}) origination = kwargs.get("origination", "ALLOW") @@ -43,7 +41,7 @@ def _create_origin_endpoint_config(**kwargs): DashPackage=dash_package, Description=description, HlsPackage=hls_package, - Id=id, + Id=endpoint_id, ManifestName=manifest_name, MssPackage=mss_package, Origination=origination, diff --git a/tests/test_mediapackage/test_server.py b/tests/test_mediapackage/test_server.py index 05adfb66e..92d9662a3 100644 --- a/tests/test_mediapackage/test_server.py +++ b/tests/test_mediapackage/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_mediapackage diff --git a/tests/test_mediastore/test_mediastore.py b/tests/test_mediastore/test_mediastore.py index b0dd1851f..4dada0f7a 100644 --- a/tests/test_mediastore/test_mediastore.py +++ b/tests/test_mediastore/test_mediastore.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_mediastore diff --git a/tests/test_mediastore/test_server.py b/tests/test_mediastore/test_server.py index 040721ae7..520d891a0 100644 --- a/tests/test_mediastore/test_server.py +++ b/tests/test_mediastore/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_mediastore diff --git a/tests/test_mediastoredata/test_mediastoredata.py b/tests/test_mediastoredata/test_mediastoredata.py index 3f1d6d95a..e14860813 100644 --- a/tests/test_mediastoredata/test_mediastoredata.py +++ b/tests/test_mediastoredata/test_mediastoredata.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_mediastoredata diff --git a/tests/test_mediastoredata/test_server.py b/tests/test_mediastoredata/test_server.py index 1c6a0ecaa..bd4315da7 100644 --- a/tests/test_mediastoredata/test_server.py +++ b/tests/test_mediastoredata/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_mediastoredata diff --git a/tests/test_opsworks/test_apps.py b/tests/test_opsworks/test_apps.py index 1d3445c7d..22c197d76 100644 --- a/tests/test_opsworks/test_apps.py +++ b/tests/test_opsworks/test_apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto3 from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import import re from moto import mock_opsworks diff --git a/tests/test_opsworks/test_instances.py b/tests/test_opsworks/test_instances.py index f5e622ac5..0ff3a5ad7 100644 --- a/tests/test_opsworks/test_instances.py +++ b/tests/test_opsworks/test_instances.py @@ -1,6 +1,5 @@ -from __future__ import unicode_literals import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_opsworks from moto import mock_ec2 diff --git a/tests/test_opsworks/test_layers.py b/tests/test_opsworks/test_layers.py index 08d5a1ce4..d4752a8dc 100644 --- a/tests/test_opsworks/test_layers.py +++ b/tests/test_opsworks/test_layers.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto3 from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import import re from moto import mock_opsworks diff --git a/tests/test_opsworks/test_stack.py b/tests/test_opsworks/test_stack.py index 277eda1ec..399257f96 100644 --- a/tests/test_opsworks/test_stack.py +++ b/tests/test_opsworks/test_stack.py @@ -1,6 +1,5 @@ -from __future__ import unicode_literals import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import re from moto import mock_opsworks diff --git a/tests/test_organizations/organizations_test_utils.py b/tests/test_organizations/organizations_test_utils.py index f45197ac7..f935cea7c 100644 --- a/tests/test_organizations/organizations_test_utils.py +++ b/tests/test_organizations/organizations_test_utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import datetime from moto.organizations import utils diff --git a/tests/test_organizations/test_organizations_boto3.py b/tests/test_organizations/test_organizations_boto3.py index 09cec4529..ea9c27c55 100644 --- a/tests/test_organizations/test_organizations_boto3.py +++ b/tests/test_organizations/test_organizations_boto3.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from datetime import datetime from moto.organizations.exceptions import InvalidInputException, TargetNotFoundException @@ -14,7 +12,7 @@ from moto.organizations.models import ( import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest @@ -71,7 +69,7 @@ def test_describe_organization(): def test_describe_organization_exception(): client = boto3.client("organizations", region_name="us-east-1") with pytest.raises(ClientError) as e: - response = client.describe_organization() + client.describe_organization() ex = e.value ex.operation_name.should.equal("DescribeOrganization") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -118,9 +116,9 @@ def test_describe_organizational_unit(): @mock_organizations def test_describe_organizational_unit_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] with pytest.raises(ClientError) as e: - response = client.describe_organizational_unit( + client.describe_organizational_unit( OrganizationalUnitId=utils.make_random_root_id() ) ex = e.value @@ -149,7 +147,7 @@ def test_list_organizational_units_for_parent(): def test_list_organizational_units_for_parent_exception(): client = boto3.client("organizations", region_name="us-east-1") with pytest.raises(ClientError) as e: - response = client.list_organizational_units_for_parent( + client.list_organizational_units_for_parent( ParentId=utils.make_random_root_id() ) ex = e.value @@ -203,7 +201,7 @@ def test_describe_account(): def test_describe_account_exception(): client = boto3.client("organizations", region_name="us-east-1") with pytest.raises(ClientError) as e: - response = client.describe_account(AccountId=utils.make_random_account_id()) + client.describe_account(AccountId=utils.make_random_account_id()) ex = e.value ex.operation_name.should.equal("DescribeAccount") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -234,7 +232,7 @@ def test_list_accounts(): @mock_organizations def test_list_accounts_for_parent(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] account_id = client.create_account(AccountName=mockname, Email=mockemail)[ "CreateAccountStatus" @@ -246,7 +244,7 @@ def test_list_accounts_for_parent(): @mock_organizations def test_move_account(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] account_id = client.create_account(AccountName=mockname, Email=mockemail)[ "CreateAccountStatus" @@ -263,7 +261,7 @@ def test_move_account(): @mock_organizations def test_list_parents_for_ou(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou01 = client.create_organizational_unit(ParentId=root_id, Name="ou01") ou01_id = ou01["OrganizationalUnit"]["Id"] @@ -282,7 +280,7 @@ def test_list_parents_for_ou(): @mock_organizations def test_list_parents_for_accounts(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou01 = client.create_organizational_unit(ParentId=root_id, Name="ou01") ou01_id = ou01["OrganizationalUnit"]["Id"] @@ -308,7 +306,7 @@ def test_list_parents_for_accounts(): @mock_organizations def test_list_children(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou01 = client.create_organizational_unit(ParentId=root_id, Name="ou01") ou01_id = ou01["OrganizationalUnit"]["Id"] @@ -342,18 +340,16 @@ def test_list_children(): @mock_organizations def test_list_children_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] with pytest.raises(ClientError) as e: - response = client.list_children( - ParentId=utils.make_random_root_id(), ChildType="ACCOUNT" - ) + client.list_children(ParentId=utils.make_random_root_id(), ChildType="ACCOUNT") ex = e.value ex.operation_name.should.equal("ListChildren") ex.response["Error"]["Code"].should.equal("400") ex.response["Error"]["Message"].should.contain("ParentNotFoundException") with pytest.raises(ClientError) as e: - response = client.list_children(ParentId=root_id, ChildType="BLEE") + client.list_children(ParentId=root_id, ChildType="BLEE") ex = e.value ex.operation_name.should.equal("ListChildren") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -370,9 +366,9 @@ def test_list_create_account_status(): createAccountStatuses.should.have.length_of(1) validate_create_account_status(createAccountStatuses[0]) - request_id = client.create_account(AccountName=mockname, Email=mockemail)[ - "CreateAccountStatus" - ]["Id"] + client.create_account(AccountName=mockname, Email=mockemail)["CreateAccountStatus"][ + "Id" + ] response = client.list_create_account_status() createAccountStatuses = response["CreateAccountStatuses"] createAccountStatuses.should.have.length_of(2) @@ -405,8 +401,8 @@ def test_list_create_account_status_in_progress(): def test_get_paginated_list_create_account_status(): client = boto3.client("organizations", region_name="us-east-1") client.create_organization(FeatureSet="ALL")["Organization"] - for i in range(5): - request_id = client.create_account(AccountName=mockname, Email=mockemail)[ + for _ in range(5): + client.create_account(AccountName=mockname, Email=mockemail)[ "CreateAccountStatus" ]["Id"] response = client.list_create_account_status(MaxResults=2) @@ -500,13 +496,13 @@ def test_describe_policy_exception(): client.create_organization(FeatureSet="ALL")["Organization"] policy_id = "p-47fhe9s3" with pytest.raises(ClientError) as e: - response = client.describe_policy(PolicyId=policy_id) + client.describe_policy(PolicyId=policy_id) ex = e.value ex.operation_name.should.equal("DescribePolicy") ex.response["Error"]["Code"].should.equal("400") ex.response["Error"]["Message"].should.contain("PolicyNotFoundException") with pytest.raises(ClientError) as e: - response = client.describe_policy(PolicyId="meaninglessstring") + client.describe_policy(PolicyId="meaninglessstring") ex = e.value ex.operation_name.should.equal("DescribePolicy") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -517,7 +513,7 @@ def test_describe_policy_exception(): @mock_organizations def test_attach_policy(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou_id = client.create_organizational_unit(ParentId=root_id, Name="ou01")[ "OrganizationalUnit" @@ -542,7 +538,7 @@ def test_attach_policy(): @mock_organizations def test_detach_policy(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou_id = client.create_organizational_unit(ParentId=root_id, Name="ou01")[ "OrganizationalUnit" @@ -585,9 +581,9 @@ def get_nonaws_policies(account_id, client): @mock_organizations def test_detach_policy_root_ou_not_found_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] - ou_id = client.create_organizational_unit(ParentId=root_id, Name="ou01")[ + client.create_organizational_unit(ParentId=root_id, Name="ou01")[ "OrganizationalUnit" ]["Id"] account_id = client.create_account(AccountName=mockname, Email=mockemail)[ @@ -602,7 +598,7 @@ def test_detach_policy_root_ou_not_found_exception(): client.attach_policy(PolicyId=policy_id, TargetId=root_id) client.attach_policy(PolicyId=policy_id, TargetId=account_id) with pytest.raises(ClientError) as e: - response = client.detach_policy(PolicyId=policy_id, TargetId="r-xy85") + client.detach_policy(PolicyId=policy_id, TargetId="r-xy85") ex = e.value ex.operation_name.should.equal("DetachPolicy") ex.response["Error"]["Code"].should.equal("400") @@ -614,7 +610,7 @@ def test_detach_policy_root_ou_not_found_exception(): @mock_organizations def test_detach_policy_ou_not_found_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou_id = client.create_organizational_unit(ParentId=root_id, Name="ou01")[ "OrganizationalUnit" @@ -627,9 +623,7 @@ def test_detach_policy_ou_not_found_exception(): )["Policy"]["PolicySummary"]["Id"] client.attach_policy(PolicyId=policy_id, TargetId=ou_id) with pytest.raises(ClientError) as e: - response = client.detach_policy( - PolicyId=policy_id, TargetId="ou-zx86-z3x4yr2t7" - ) + client.detach_policy(PolicyId=policy_id, TargetId="ou-zx86-z3x4yr2t7") ex = e.value ex.operation_name.should.equal("DetachPolicy") ex.response["Error"]["Code"].should.equal("400") @@ -641,7 +635,7 @@ def test_detach_policy_ou_not_found_exception(): @mock_organizations def test_detach_policy_account_id_not_found_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] account_id = client.create_account(AccountName=mockname, Email=mockemail)[ "CreateAccountStatus" ]["AccountId"] @@ -653,7 +647,7 @@ def test_detach_policy_account_id_not_found_exception(): )["Policy"]["PolicySummary"]["Id"] client.attach_policy(PolicyId=policy_id, TargetId=account_id) with pytest.raises(ClientError) as e: - response = client.detach_policy(PolicyId=policy_id, TargetId="111619863336") + client.detach_policy(PolicyId=policy_id, TargetId="111619863336") ex = e.value ex.operation_name.should.equal("DetachPolicy") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -666,7 +660,7 @@ def test_detach_policy_account_id_not_found_exception(): @mock_organizations def test_detach_policy_invalid_target_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou_id = client.create_organizational_unit(ParentId=root_id, Name="ou01")[ "OrganizationalUnit" @@ -679,7 +673,7 @@ def test_detach_policy_invalid_target_exception(): )["Policy"]["PolicySummary"]["Id"] client.attach_policy(PolicyId=policy_id, TargetId=ou_id) with pytest.raises(ClientError) as e: - response = client.detach_policy(PolicyId=policy_id, TargetId="invalidtargetid") + client.detach_policy(PolicyId=policy_id, TargetId="invalidtargetid") ex = e.value ex.operation_name.should.equal("DetachPolicy") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -690,7 +684,7 @@ def test_detach_policy_invalid_target_exception(): @mock_organizations def test_delete_policy(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] base_policies = client.list_policies(Filter="SERVICE_CONTROL_POLICY")["Policies"] base_policies.should.have.length_of(1) policy_id = client.create_policy( @@ -711,10 +705,10 @@ def test_delete_policy(): @mock_organizations def test_delete_policy_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] non_existent_policy_id = utils.make_random_policy_id() with pytest.raises(ClientError) as e: - response = client.delete_policy(PolicyId=non_existent_policy_id) + client.delete_policy(PolicyId=non_existent_policy_id) ex = e.value ex.operation_name.should.equal("DeletePolicy") ex.response["Error"]["Code"].should.equal("400") @@ -730,7 +724,7 @@ def test_delete_policy_exception(): root_id = client.list_roots()["Roots"][0]["Id"] client.attach_policy(PolicyId=policy_id, TargetId=root_id) with pytest.raises(ClientError) as e: - response = client.delete_policy(PolicyId=policy_id) + client.delete_policy(PolicyId=policy_id) ex = e.value ex.operation_name.should.equal("DeletePolicy") ex.response["Error"]["Code"].should.equal("400") @@ -751,7 +745,7 @@ def test_attach_policy_exception(): Type="SERVICE_CONTROL_POLICY", )["Policy"]["PolicySummary"]["Id"] with pytest.raises(ClientError) as e: - response = client.attach_policy(PolicyId=policy_id, TargetId=root_id) + client.attach_policy(PolicyId=policy_id, TargetId=root_id) ex = e.value ex.operation_name.should.equal("AttachPolicy") ex.response["Error"]["Code"].should.equal("400") @@ -759,7 +753,7 @@ def test_attach_policy_exception(): "OrganizationalUnitNotFoundException" ) with pytest.raises(ClientError) as e: - response = client.attach_policy(PolicyId=policy_id, TargetId=ou_id) + client.attach_policy(PolicyId=policy_id, TargetId=ou_id) ex = e.value ex.operation_name.should.equal("AttachPolicy") ex.response["Error"]["Code"].should.equal("400") @@ -767,7 +761,7 @@ def test_attach_policy_exception(): "OrganizationalUnitNotFoundException" ) with pytest.raises(ClientError) as e: - response = client.attach_policy(PolicyId=policy_id, TargetId=account_id) + client.attach_policy(PolicyId=policy_id, TargetId=account_id) ex = e.value ex.operation_name.should.equal("AttachPolicy") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -776,9 +770,7 @@ def test_attach_policy_exception(): "You specified an account that doesn't exist." ) with pytest.raises(ClientError) as e: - response = client.attach_policy( - PolicyId=policy_id, TargetId="meaninglessstring" - ) + client.attach_policy(PolicyId=policy_id, TargetId="meaninglessstring") ex = e.value ex.operation_name.should.equal("AttachPolicy") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) @@ -814,10 +806,10 @@ def test_update_policy(): @mock_organizations def test_update_policy_exception(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] non_existent_policy_id = utils.make_random_policy_id() with pytest.raises(ClientError) as e: - response = client.update_policy(PolicyId=non_existent_policy_id) + client.update_policy(PolicyId=non_existent_policy_id) ex = e.value ex.operation_name.should.equal("UpdatePolicy") ex.response["Error"]["Code"].should.equal("400") @@ -879,9 +871,7 @@ def test_list_policies_for_target_exception(): ou_id = "ou-gi99-i7r8eh2i2" account_id = "126644886543" with pytest.raises(ClientError) as e: - response = client.list_policies_for_target( - TargetId=ou_id, Filter="SERVICE_CONTROL_POLICY" - ) + client.list_policies_for_target(TargetId=ou_id, Filter="SERVICE_CONTROL_POLICY") ex = e.value ex.operation_name.should.equal("ListPoliciesForTarget") ex.response["Error"]["Code"].should.equal("400") @@ -889,7 +879,7 @@ def test_list_policies_for_target_exception(): "OrganizationalUnitNotFoundException" ) with pytest.raises(ClientError) as e: - response = client.list_policies_for_target( + client.list_policies_for_target( TargetId=account_id, Filter="SERVICE_CONTROL_POLICY" ) ex = e.value @@ -900,7 +890,7 @@ def test_list_policies_for_target_exception(): "You specified an account that doesn't exist." ) with pytest.raises(ClientError) as e: - response = client.list_policies_for_target( + client.list_policies_for_target( TargetId="meaninglessstring", Filter="SERVICE_CONTROL_POLICY" ) ex = e.value @@ -941,7 +931,7 @@ def test_list_policies_for_target_exception(): @mock_organizations def test_list_targets_for_policy(): client = boto3.client("organizations", region_name="us-east-1") - org = client.create_organization(FeatureSet="ALL")["Organization"] + client.create_organization(FeatureSet="ALL")["Organization"] root_id = client.list_roots()["Roots"][0]["Id"] ou_id = client.create_organizational_unit(ParentId=root_id, Name="ou01")[ "OrganizationalUnit" @@ -975,13 +965,13 @@ def test_list_targets_for_policy_exception(): client.create_organization(FeatureSet="ALL")["Organization"] policy_id = "p-47fhe9s3" with pytest.raises(ClientError) as e: - response = client.list_targets_for_policy(PolicyId=policy_id) + client.list_targets_for_policy(PolicyId=policy_id) ex = e.value ex.operation_name.should.equal("ListTargetsForPolicy") ex.response["Error"]["Code"].should.equal("400") ex.response["Error"]["Message"].should.contain("PolicyNotFoundException") with pytest.raises(ClientError) as e: - response = client.list_targets_for_policy(PolicyId="meaninglessstring") + client.list_targets_for_policy(PolicyId="meaninglessstring") ex = e.value ex.operation_name.should.equal("ListTargetsForPolicy") ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400) diff --git a/tests/test_packages/__init__.py b/tests/test_packages/__init__.py index 01fe5ab1f..a7d8ed43f 100644 --- a/tests/test_packages/__init__.py +++ b/tests/test_packages/__init__.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import logging # Disable extra logging for tests diff --git a/tests/test_packages/test_httpretty.py b/tests/test_packages/test_httpretty.py index ba6ba95d2..e6bed31fe 100644 --- a/tests/test_packages/test_httpretty.py +++ b/tests/test_packages/test_httpretty.py @@ -1,7 +1,5 @@ # #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import unicode_literals - from moto.packages.httpretty.core import ( HTTPrettyRequest, fake_gethostname, diff --git a/tests/test_polly/test_polly.py b/tests/test_polly/test_polly.py index 6c99d0538..235311373 100644 --- a/tests/test_polly/test_polly.py +++ b/tests/test_polly/test_polly.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals - from botocore.exceptions import ClientError import boto3 -import sure # noqa -import pytest +import sure # noqa # pylint: disable=unused-import from moto import mock_polly # Polly only available in a few regions diff --git a/tests/test_polly/test_server.py b/tests/test_polly/test_server.py index 756c9d7e4..1668b280a 100644 --- a/tests/test_polly/test_server.py +++ b/tests/test_polly/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_polly diff --git a/tests/test_ram/test_ram.py b/tests/test_ram/test_ram.py index 73a23331b..772058441 100644 --- a/tests/test_ram/test_ram.py +++ b/tests/test_ram/test_ram.py @@ -2,7 +2,7 @@ import time from datetime import datetime import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest diff --git a/tests/test_rds/test_rds.py b/tests/test_rds/test_rds.py index da07b4e24..9f5abbba5 100644 --- a/tests/test_rds/test_rds.py +++ b/tests/test_rds/test_rds.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import boto3 import boto.rds import boto.vpc from boto.exception import BotoServerError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2_deprecated, mock_rds_deprecated, mock_rds diff --git a/tests/test_rds/test_server.py b/tests/test_rds/test_server.py index ab53e83b4..8d81cbd44 100644 --- a/tests/test_rds/test_server.py +++ b/tests/test_rds/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_rds diff --git a/tests/test_rds2/test_filters.py b/tests/test_rds2/test_filters.py index ab9aeb4ef..6c56ad13b 100644 --- a/tests/test_rds2/test_filters.py +++ b/tests/test_rds2/test_filters.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_rds2 diff --git a/tests/test_rds2/test_rds2.py b/tests/test_rds2/test_rds2.py index 435e8437d..e7dba8c38 100644 --- a/tests/test_rds2/test_rds2.py +++ b/tests/test_rds2/test_rds2.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - from botocore.exceptions import ClientError import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2, mock_kms, mock_rds2 from moto.core import ACCOUNT_ID @@ -61,7 +59,7 @@ def test_create_database_no_allocated_storage(): @mock_rds2 def test_create_database_non_existing_option_group(): conn = boto3.client("rds", region_name="us-west-2") - database = conn.create_db_instance.when.called_with( + conn.create_db_instance.when.called_with( DBInstanceIdentifier="db-master-1", AllocatedStorage=10, Engine="postgres", @@ -245,7 +243,7 @@ def test_stop_multi_az_postgres(): @mock_rds2 def test_fail_to_stop_readreplica(): conn = boto3.client("rds", region_name="us-west-2") - database = conn.create_db_instance( + conn.create_db_instance( DBInstanceIdentifier="db-master-1", AllocatedStorage=10, Engine="postgres", @@ -351,7 +349,7 @@ def test_describe_non_existent_database(): @mock_rds2 def test_modify_db_instance(): conn = boto3.client("rds", region_name="us-west-2") - database = conn.create_db_instance( + conn.create_db_instance( DBInstanceIdentifier="db-master-1", AllocatedStorage=10, DBInstanceClass="postgres", @@ -379,7 +377,7 @@ def test_modify_db_instance(): @mock_rds2 def test_rename_db_instance(): conn = boto3.client("rds", region_name="us-west-2") - database = conn.create_db_instance( + conn.create_db_instance( DBInstanceIdentifier="db-master-1", AllocatedStorage=10, DBInstanceClass="postgres", @@ -1010,7 +1008,7 @@ def test_add_tags_snapshot(): Port=1234, DBSecurityGroups=["my_sg"], ) - snapshot = conn.create_db_snapshot( + conn.create_db_snapshot( DBInstanceIdentifier="db-primary-1", DBSnapshotIdentifier="snapshot-without-tags", Tags=[{"Key": "foo", "Value": "bar"}, {"Key": "foo1", "Value": "bar1"}], @@ -1043,7 +1041,7 @@ def test_remove_tags_snapshot(): Port=1234, DBSecurityGroups=["my_sg"], ) - snapshot = conn.create_db_snapshot( + conn.create_db_snapshot( DBInstanceIdentifier="db-primary-1", DBSnapshotIdentifier="snapshot-with-tags", Tags=[{"Key": "foo", "Value": "bar"}, {"Key": "foo1", "Value": "bar1"}], @@ -1350,7 +1348,7 @@ def test_modify_database_subnet_group(): SubnetIds=[subnet1["SubnetId"], subnet2["SubnetId"]], ) - groups = conn.describe_db_subnet_groups()["DBSubnetGroups"] + conn.describe_db_subnet_groups()["DBSubnetGroups"] # FIXME: Group is deleted atm # TODO: we should check whether all attrs are persisted @@ -1542,7 +1540,7 @@ def test_remove_tags_database_subnet_group(): def test_create_database_replica(): conn = boto3.client("rds", region_name="us-west-2") - database = conn.create_db_instance( + conn.create_db_instance( DBInstanceIdentifier="db-master-1", AllocatedStorage=10, Engine="postgres", @@ -1629,7 +1627,7 @@ def test_create_db_parameter_group(): @mock_rds2 def test_create_db_instance_with_parameter_group(): conn = boto3.client("rds", region_name="us-west-2") - db_parameter_group = conn.create_db_parameter_group( + conn.create_db_parameter_group( DBParameterGroupName="test", DBParameterGroupFamily="mysql5.6", Description="test parameter group", @@ -1691,7 +1689,7 @@ def test_modify_db_instance_with_parameter_group(): "in-sync" ) - db_parameter_group = conn.create_db_parameter_group( + conn.create_db_parameter_group( DBParameterGroupName="test", DBParameterGroupFamily="mysql5.6", Description="test parameter group", diff --git a/tests/test_rds2/test_rds2_cloudformation.py b/tests/test_rds2/test_rds2_cloudformation.py index e1492363a..015ceb26f 100644 --- a/tests/test_rds2/test_rds2_cloudformation.py +++ b/tests/test_rds2/test_rds2_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudformation, mock_ec2, mock_rds2 from tests.test_cloudformation.fixtures import rds_mysql_with_db_parameter_group from tests.test_cloudformation.fixtures import rds_mysql_with_read_replica diff --git a/tests/test_rds2/test_rds2_clusters.py b/tests/test_rds2/test_rds2_clusters.py index 29fbf9486..923369f93 100644 --- a/tests/test_rds2/test_rds2_clusters.py +++ b/tests/test_rds2/test_rds2_clusters.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_rds2 diff --git a/tests/test_rds2/test_server.py b/tests/test_rds2/test_server.py index dade82c9c..cf57ce750 100644 --- a/tests/test_rds2/test_server.py +++ b/tests/test_rds2/test_server.py @@ -1,9 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa - -import moto.server as server -from moto import mock_rds2 +import sure # noqa # pylint: disable=unused-import """ Test the different server responses diff --git a/tests/test_rds2/test_utils.py b/tests/test_rds2/test_utils.py index 5cb51a0d5..e6b4c0c50 100644 --- a/tests/test_rds2/test_utils.py +++ b/tests/test_rds2/test_utils.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import pytest from moto.rds2.utils import ( diff --git a/tests/test_redshift/test_redshift.py b/tests/test_redshift/test_redshift.py index ce387a9b5..b952be122 100644 --- a/tests/test_redshift/test_redshift.py +++ b/tests/test_redshift/test_redshift.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import time import datetime @@ -14,7 +12,7 @@ from boto.redshift.exceptions import ( ) from botocore.exceptions import ClientError import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 from moto import mock_ec2_deprecated diff --git a/tests/test_redshift/test_redshift_cloudformation.py b/tests/test_redshift/test_redshift_cloudformation.py index ff369ec61..fdad3093a 100644 --- a/tests/test_redshift/test_redshift_cloudformation.py +++ b/tests/test_redshift/test_redshift_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudformation, mock_ec2, mock_redshift from tests.test_cloudformation.fixtures import redshift diff --git a/tests/test_redshift/test_server.py b/tests/test_redshift/test_server.py index 585596cbc..463f4e46e 100644 --- a/tests/test_redshift/test_server.py +++ b/tests/test_redshift/test_server.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - +import sure # noqa # pylint: disable=unused-import import json import pytest -import sure # noqa import xmltodict import moto.server as server diff --git a/tests/test_resourcegroups/test_resourcegroups.py b/tests/test_resourcegroups/test_resourcegroups.py index c3dd1cd52..f48aa3003 100644 --- a/tests/test_resourcegroups/test_resourcegroups.py +++ b/tests/test_resourcegroups/test_resourcegroups.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_resourcegroups @@ -143,7 +141,7 @@ def test_untag(): def test_update_group(): resource_groups = boto3.client("resource-groups", region_name="us-east-1") - get_response = test_get_group() + test_get_group() response = resource_groups.update_group( GroupName="test_resource_group", Description="description_2" diff --git a/tests/test_resourcegroupstaggingapi/test_resourcegroupstaggingapi.py b/tests/test_resourcegroupstaggingapi/test_resourcegroupstaggingapi.py index ae478dc97..00cc2e9a1 100644 --- a/tests/test_resourcegroupstaggingapi/test_resourcegroupstaggingapi.py +++ b/tests/test_resourcegroupstaggingapi/test_resourcegroupstaggingapi.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ec2 from moto import mock_elbv2 from moto import mock_kms diff --git a/tests/test_resourcegroupstaggingapi/test_server.py b/tests/test_resourcegroupstaggingapi/test_server.py index 836fa5828..1ac394a62 100644 --- a/tests/test_resourcegroupstaggingapi/test_server.py +++ b/tests/test_resourcegroupstaggingapi/test_server.py @@ -1,6 +1,4 @@ -from __future__ import unicode_literals - -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_route53/test_route53.py b/tests/test_route53/test_route53.py index 93dfb3075..4c3a2bcd9 100644 --- a/tests/test_route53/test_route53.py +++ b/tests/test_route53/test_route53.py @@ -1,14 +1,10 @@ -from __future__ import unicode_literals - import boto import boto3 from boto.route53.healthcheck import HealthCheck from boto.route53.record import ResourceRecordSets from botocore.exceptions import ClientError -import sure # noqa - -import uuid +import sure # noqa # pylint: disable=unused-import import botocore import pytest diff --git a/tests/test_route53/test_route53_boto3.py b/tests/test_route53/test_route53_boto3.py index 3ed9e9718..ec13f5fbc 100644 --- a/tests/test_route53/test_route53_boto3.py +++ b/tests/test_route53/test_route53_boto3.py @@ -1,5 +1,5 @@ import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_route53 diff --git a/tests/test_route53/test_route53_cloudformation.py b/tests/test_route53/test_route53_cloudformation.py index 40793f2bd..54de9a254 100644 --- a/tests/test_route53/test_route53_cloudformation.py +++ b/tests/test_route53/test_route53_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from copy import deepcopy from moto import mock_cloudformation, mock_ec2, mock_route53 diff --git a/tests/test_s3/test_s3.py b/tests/test_s3/test_s3.py index 9b37485e0..ff299cebb 100644 --- a/tests/test_s3/test_s3.py +++ b/tests/test_s3/test_s3.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import datetime import os from boto3 import Session @@ -25,16 +22,14 @@ from boto.s3.key import Key from freezegun import freeze_time import requests -from moto.s3 import models from moto.s3.responses import DEFAULT_REGION_NAME from unittest import SkipTest import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import settings, mock_s3, mock_s3_deprecated, mock_config import moto.s3.models as s3model -from moto.s3.exceptions import InvalidTagError from moto.core.exceptions import InvalidNextTokenException from moto.settings import get_s3_default_key_buffer_size, S3_UPLOAD_PART_MIN_SIZE from uuid import uuid4 @@ -65,10 +60,10 @@ def reduced_min_part_size(f): class MyModel(object): - def __init__(self, name, value, metadata={}): + def __init__(self, name, value, metadata=None): self.name = name self.value = value - self.metadata = metadata + self.metadata = metadata or {} def save(self): s3 = boto3.client("s3", region_name=DEFAULT_REGION_NAME) @@ -742,7 +737,6 @@ def test_key_save_to_missing_bucket(): @mock_s3 def test_key_save_to_missing_bucket_boto3(): s3 = boto3.resource("s3") - bucket = s3.Bucket("mybucket") key = s3.Object("mybucket", "the-key") with pytest.raises(ClientError) as ex: @@ -1375,7 +1369,6 @@ def test_delete_keys_invalid(): @mock_s3 def test_delete_missing_key_boto3(): s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) - client = boto3.client("s3", region_name=DEFAULT_REGION_NAME) bucket = s3.Bucket("foobar") bucket.create() @@ -1531,7 +1524,6 @@ def test_bucket_key_listing_order(): @mock_s3 def test_bucket_key_listing_order_boto3(): s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) - client = boto3.client("s3", region_name=DEFAULT_REGION_NAME) bucket_name = "test_bucket" bucket = s3.Bucket(bucket_name) bucket.create() @@ -1587,7 +1579,6 @@ def test_key_with_reduced_redundancy(): @mock_s3 def test_key_with_reduced_redundancy_boto3(): s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) - client = boto3.client("s3", region_name=DEFAULT_REGION_NAME) bucket_name = "test_bucket" bucket = s3.Bucket(bucket_name) bucket.create() @@ -1666,7 +1657,6 @@ def test_restore_key(): @mock_s3 def test_restore_key_boto3(): s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) - client = boto3.client("s3", region_name=DEFAULT_REGION_NAME) bucket = s3.Bucket("foobar") bucket.create() @@ -1726,7 +1716,6 @@ def test_get_versioning_status(): @mock_s3 def test_get_versioning_status_boto3(): s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) - client = boto3.client("s3", region_name=DEFAULT_REGION_NAME) bucket = s3.Bucket("foobar") bucket.create() @@ -2054,12 +2043,12 @@ def test_default_key_buffer_size(): os.environ["MOTO_S3_DEFAULT_KEY_BUFFER_SIZE"] = "2" # 2 bytes assert get_s3_default_key_buffer_size() == 2 - fk = models.FakeKey("a", os.urandom(1)) # 1 byte string + fk = s3model.FakeKey("a", os.urandom(1)) # 1 byte string assert fk._value_buffer._rolled == False os.environ["MOTO_S3_DEFAULT_KEY_BUFFER_SIZE"] = "1" # 1 byte assert get_s3_default_key_buffer_size() == 1 - fk = models.FakeKey("a", os.urandom(3)) # 3 byte string + fk = s3model.FakeKey("a", os.urandom(3)) # 3 byte string assert fk._value_buffer._rolled == True # if no MOTO_S3_DEFAULT_KEY_BUFFER_SIZE env variable is present the buffer size should be less than @@ -2142,7 +2131,6 @@ def test_setting_content_encoding(): @mock_s3 def test_setting_content_encoding_boto3(): s3 = boto3.resource("s3", region_name=DEFAULT_REGION_NAME) - client = boto3.client("s3", region_name=DEFAULT_REGION_NAME) bucket = s3.Bucket("mybucket") bucket.create() @@ -2173,7 +2161,7 @@ def test_bucket_location_nondefault(): cli = boto3.client("s3", region_name="eu-central-1") bucket_name = "mybucket" # LocationConstraint set for non default regions - resp = cli.create_bucket( + cli.create_bucket( Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-central-1"}, ) @@ -3313,7 +3301,7 @@ def test_boto3_copy_object_with_versioning(): client.put_object(Bucket="blah", Key="test1", Body=b"test1") client.put_object(Bucket="blah", Key="test2", Body=b"test2") - obj1_version = client.get_object(Bucket="blah", Key="test1")["VersionId"] + client.get_object(Bucket="blah", Key="test1")["VersionId"] obj2_version = client.get_object(Bucket="blah", Key="test2")["VersionId"] client.copy_object( @@ -3510,7 +3498,7 @@ def test_boto3_delete_versioned_bucket_returns_meta(): Bucket="blah", VersioningConfiguration={"Status": "Enabled"} ) - put_resp = client.put_object(Bucket="blah", Key="test1", Body=b"test1") + client.put_object(Bucket="blah", Key="test1", Body=b"test1") # Delete the object del_resp = client.delete_object(Bucket="blah", Key="test1") @@ -4419,7 +4407,7 @@ def test_put_bucket_notification_errors(): s3.create_bucket(Bucket="bucket") # With incorrect ARNs: - for tech, arn in [("Queue", "sqs"), ("Topic", "sns"), ("LambdaFunction", "lambda")]: + for tech in ["Queue", "Topic", "LambdaFunction"]: with pytest.raises(ClientError) as err: s3.put_bucket_notification_configuration( Bucket="bucket", @@ -6151,7 +6139,7 @@ def test_encryption(): conn = boto3.client("s3", region_name="us-east-1") conn.create_bucket(Bucket="mybucket") - with pytest.raises(ClientError) as exc: + with pytest.raises(ClientError): conn.get_bucket_encryption(Bucket="mybucket") sse_config = { @@ -6178,6 +6166,12 @@ def test_encryption(): conn.delete_bucket_encryption(Bucket="mybucket") with pytest.raises(ClientError) as exc: conn.get_bucket_encryption(Bucket="mybucket") + err = exc.value.response["Error"] + err["Code"].should.equal("ServerSideEncryptionConfigurationNotFoundError") + err["Message"].should.equal( + "The server side encryption configuration was not found" + ) + err["BucketName"].should.equal("mybucket") @mock_s3 diff --git a/tests/test_s3/test_s3_acl.py b/tests/test_s3/test_s3_acl.py index 78291fe75..d01d86c20 100644 --- a/tests/test_s3/test_s3_acl.py +++ b/tests/test_s3/test_s3_acl.py @@ -2,7 +2,7 @@ import boto3 import os import pytest import requests -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from botocore.handlers import disable_signing diff --git a/tests/test_s3/test_s3_auth.py b/tests/test_s3/test_s3_auth.py index a829e3190..af6d1cddc 100644 --- a/tests/test_s3/test_s3_auth.py +++ b/tests/test_s3/test_s3_auth.py @@ -1,7 +1,7 @@ import boto3 import json import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_iam, mock_s3, settings diff --git a/tests/test_s3/test_s3_cloudformation.py b/tests/test_s3/test_s3_cloudformation.py index ebaa03b78..a8c9dae04 100644 --- a/tests/test_s3/test_s3_cloudformation.py +++ b/tests/test_s3/test_s3_cloudformation.py @@ -1,7 +1,7 @@ import json import boto3 -import sure # noqa +import sure # pylint: disable=unused-import from moto import mock_s3, mock_cloudformation @@ -18,9 +18,7 @@ def test_s3_bucket_cloudformation_basic(): "Outputs": {"Bucket": {"Value": {"Ref": "testInstance"}}}, } template_json = json.dumps(template) - stack_id = cf.create_stack(StackName="test_stack", TemplateBody=template_json)[ - "StackId" - ] + cf.create_stack(StackName="test_stack", TemplateBody=template_json) stack_description = cf.describe_stacks(StackName="test_stack")["Stacks"][0] s3.head_bucket(Bucket=stack_description["Outputs"][0]["OutputValue"]) @@ -55,10 +53,8 @@ def test_s3_bucket_cloudformation_with_properties(): "Outputs": {"Bucket": {"Value": {"Ref": "testInstance"}}}, } template_json = json.dumps(template) - stack_id = cf.create_stack(StackName="test_stack", TemplateBody=template_json)[ - "StackId" - ] - stack_description = cf.describe_stacks(StackName="test_stack")["Stacks"][0] + cf.create_stack(StackName="test_stack", TemplateBody=template_json) + cf.describe_stacks(StackName="test_stack") s3.head_bucket(Bucket=bucket_name) encryption = s3.get_bucket_encryption(Bucket=bucket_name) diff --git a/tests/test_s3/test_s3_lifecycle.py b/tests/test_s3/test_s3_lifecycle.py index 6060aacd1..84d12801f 100644 --- a/tests/test_s3/test_s3_lifecycle.py +++ b/tests/test_s3/test_s3_lifecycle.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals - import boto import boto3 from boto.exception import S3ResponseError from boto.s3.lifecycle import Lifecycle, Transition, Expiration, Rule -import sure # noqa +import sure # pylint: disable=unused-import from botocore.exceptions import ClientError from datetime import datetime import pytest diff --git a/tests/test_s3/test_s3_lock.py b/tests/test_s3/test_s3_lock.py index 6ff7a99a7..a73bef866 100644 --- a/tests/test_s3/test_s3_lock.py +++ b/tests/test_s3/test_s3_lock.py @@ -1,13 +1,11 @@ import time -import boto import boto3 import datetime import botocore from moto import mock_s3 -import os from botocore.config import Config from moto.s3.responses import DEFAULT_REGION_NAME -import sure +import sure # pylint: disable=unused-import @mock_s3 diff --git a/tests/test_s3/test_s3_metadata.py b/tests/test_s3/test_s3_metadata.py index 38987b6cd..7f5c73f5e 100644 --- a/tests/test_s3/test_s3_metadata.py +++ b/tests/test_s3/test_s3_metadata.py @@ -3,7 +3,7 @@ import boto3 from moto import mock_s3 from moto.s3.responses import DEFAULT_REGION_NAME -import sure # noqa +import sure # pylint: disable=unused-import @mock_s3 diff --git a/tests/test_s3/test_s3_multipart.py b/tests/test_s3/test_s3_multipart.py index 0030dfc1f..0bdf64e90 100644 --- a/tests/test_s3/test_s3_multipart.py +++ b/tests/test_s3/test_s3_multipart.py @@ -2,7 +2,7 @@ from botocore.exceptions import ClientError from moto import mock_s3 import boto3 import pytest -import sure # noqa +import sure # pylint: disable=unused-import from .test_s3 import DEFAULT_REGION_NAME diff --git a/tests/test_s3/test_s3_replication.py b/tests/test_s3/test_s3_replication.py index 442e63706..3c162c1b8 100644 --- a/tests/test_s3/test_s3_replication.py +++ b/tests/test_s3/test_s3_replication.py @@ -1,6 +1,6 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_s3 diff --git a/tests/test_s3/test_s3_storageclass.py b/tests/test_s3/test_s3_storageclass.py index ec7090369..10e6ff7d8 100644 --- a/tests/test_s3/test_s3_storageclass.py +++ b/tests/test_s3/test_s3_storageclass.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest diff --git a/tests/test_s3/test_s3_utils.py b/tests/test_s3/test_s3_utils.py index 0c14d8860..c01ba99ac 100644 --- a/tests/test_s3/test_s3_utils.py +++ b/tests/test_s3/test_s3_utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import pytest from sure import expect from moto.s3.utils import ( diff --git a/tests/test_s3/test_server.py b/tests/test_s3/test_server.py index 4d85ea5bf..cce1ef87a 100644 --- a/tests/test_s3/test_server.py +++ b/tests/test_s3/test_server.py @@ -1,9 +1,6 @@ -# coding=utf-8 - -from __future__ import unicode_literals import io from urllib.parse import urlparse, parse_qs -import sure # noqa +import sure # pylint: disable=unused-import from flask.testing import FlaskClient import moto.server as server diff --git a/tests/test_s3bucket_path/test_s3bucket_path.py b/tests/test_s3bucket_path/test_s3bucket_path.py index 44007e6a2..836c4f0c8 100644 --- a/tests/test_s3bucket_path/test_s3bucket_path.py +++ b/tests/test_s3bucket_path/test_s3bucket_path.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from urllib.request import urlopen from urllib.error import HTTPError @@ -10,7 +9,7 @@ from boto.s3.connection import OrdinaryCallingFormat from freezegun import freeze_time import requests -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_s3, mock_s3_deprecated diff --git a/tests/test_s3bucket_path/test_s3bucket_path_combo.py b/tests/test_s3bucket_path/test_s3bucket_path_combo.py index 2ca7107d9..522cea5d8 100644 --- a/tests/test_s3bucket_path/test_s3bucket_path_combo.py +++ b/tests/test_s3bucket_path/test_s3bucket_path_combo.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import boto from boto.s3.connection import OrdinaryCallingFormat diff --git a/tests/test_s3bucket_path/test_s3bucket_path_utils.py b/tests/test_s3bucket_path/test_s3bucket_path_utils.py index 072968929..255bdb3f6 100644 --- a/tests/test_s3bucket_path/test_s3bucket_path_utils.py +++ b/tests/test_s3bucket_path/test_s3bucket_path_utils.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from sure import expect from moto.s3bucket_path.utils import bucket_name_from_url diff --git a/tests/test_s3bucket_path/test_server.py b/tests/test_s3bucket_path/test_server.py index 2fe606799..4369bd59c 100644 --- a/tests/test_s3bucket_path/test_server.py +++ b/tests/test_s3bucket_path/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import from flask.testing import FlaskClient import moto.server as server diff --git a/tests/test_sagemaker/test_sagemaker_cloudformation.py b/tests/test_sagemaker/test_sagemaker_cloudformation.py index e99b3b309..4d7782ad1 100644 --- a/tests/test_sagemaker/test_sagemaker_cloudformation.py +++ b/tests/test_sagemaker/test_sagemaker_cloudformation.py @@ -1,7 +1,7 @@ import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_cloudformation, mock_sagemaker diff --git a/tests/test_sagemaker/test_sagemaker_endpoint.py b/tests/test_sagemaker/test_sagemaker_endpoint.py index 45ae96b12..549959bb5 100644 --- a/tests/test_sagemaker/test_sagemaker_endpoint.py +++ b/tests/test_sagemaker/test_sagemaker_endpoint.py @@ -1,10 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import datetime import boto3 from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sagemaker from moto.sts.models import ACCOUNT_ID diff --git a/tests/test_sagemaker/test_sagemaker_models.py b/tests/test_sagemaker/test_sagemaker_models.py index 32239d557..89d9f4273 100644 --- a/tests/test_sagemaker/test_sagemaker_models.py +++ b/tests/test_sagemaker/test_sagemaker_models.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import boto3 from botocore.exceptions import ClientError import pytest from moto import mock_sagemaker -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.sagemaker.models import VpcConfig diff --git a/tests/test_sagemaker/test_sagemaker_notebooks.py b/tests/test_sagemaker/test_sagemaker_notebooks.py index 1c958560d..010a59c97 100644 --- a/tests/test_sagemaker/test_sagemaker_notebooks.py +++ b/tests/test_sagemaker/test_sagemaker_notebooks.py @@ -1,10 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import datetime import boto3 from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sagemaker from moto.sts.models import ACCOUNT_ID diff --git a/tests/test_sagemaker/test_sagemaker_training.py b/tests/test_sagemaker/test_sagemaker_training.py index 94ab8eead..36aa01807 100644 --- a/tests/test_sagemaker/test_sagemaker_training.py +++ b/tests/test_sagemaker/test_sagemaker_training.py @@ -1,16 +1,8 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals -from moto.core.exceptions import JsonRESTError - -from re import M -from moto.core import responses -from os import O_DSYNC, scandir -import pytest import boto3 from botocore.exceptions import ClientError import datetime -from botocore.configloader import raw_config_parse -import sure # noqa +import sure # noqa # pylint: disable=unused-import +import pytest from moto import mock_sagemaker from moto.sts.models import ACCOUNT_ID diff --git a/tests/test_secretsmanager/test_list_secrets.py b/tests/test_secretsmanager/test_list_secrets.py index 8d8ddbd64..8bf9552b1 100644 --- a/tests/test_secretsmanager/test_list_secrets.py +++ b/tests/test_secretsmanager/test_list_secrets.py @@ -1,11 +1,9 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - import boto3 from moto import mock_secretsmanager from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import import pytest diff --git a/tests/test_secretsmanager/test_secretsmanager.py b/tests/test_secretsmanager/test_secretsmanager.py index 4d6b199df..fa0f99154 100644 --- a/tests/test_secretsmanager/test_secretsmanager.py +++ b/tests/test_secretsmanager/test_secretsmanager.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import boto3 from moto import mock_secretsmanager, mock_lambda, settings @@ -9,8 +6,8 @@ from botocore.exceptions import ClientError, ParamValidationError import string import pytz from datetime import datetime +import sure # noqa # pylint: disable=unused-import from uuid import uuid4 -import sure # noqa import pytest DEFAULT_SECRET_NAME = "test-secret" @@ -20,9 +17,7 @@ DEFAULT_SECRET_NAME = "test-secret" def test_get_secret_value(): conn = boto3.client("secretsmanager", region_name="us-west-2") - create_secret = conn.create_secret( - Name="java-util-test-password", SecretString="foosecret" - ) + conn.create_secret(Name="java-util-test-password", SecretString="foosecret") result = conn.get_secret_value(SecretId="java-util-test-password") assert result["SecretString"] == "foosecret" @@ -47,9 +42,7 @@ def test_get_secret_value_by_arn(): def test_get_secret_value_binary(): conn = boto3.client("secretsmanager", region_name="us-west-2") - create_secret = conn.create_secret( - Name="java-util-test-password", SecretBinary=b"foosecret" - ) + conn.create_secret(Name="java-util-test-password", SecretBinary=b"foosecret") result = conn.get_secret_value(SecretId="java-util-test-password") assert result["SecretBinary"] == b"foosecret" @@ -59,7 +52,7 @@ def test_get_secret_that_does_not_exist(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(ClientError) as cm: - result = conn.get_secret_value(SecretId="i-dont-exist") + conn.get_secret_value(SecretId="i-dont-exist") assert ( "Secrets Manager can't find the specified secret." @@ -70,12 +63,10 @@ def test_get_secret_that_does_not_exist(): @mock_secretsmanager def test_get_secret_that_does_not_match(): conn = boto3.client("secretsmanager", region_name="us-west-2") - create_secret = conn.create_secret( - Name="java-util-test-password", SecretString="foosecret" - ) + conn.create_secret(Name="java-util-test-password", SecretString="foosecret") with pytest.raises(ClientError) as cm: - result = conn.get_secret_value(SecretId="i-dont-match") + conn.get_secret_value(SecretId="i-dont-match") assert ( "Secrets Manager can't find the specified secret." @@ -92,17 +83,17 @@ def test_get_secret_value_that_is_marked_deleted(): conn.delete_secret(SecretId="test-secret") with pytest.raises(ClientError): - result = conn.get_secret_value(SecretId="test-secret") + conn.get_secret_value(SecretId="test-secret") @mock_secretsmanager def test_get_secret_that_has_no_value(): conn = boto3.client("secretsmanager", region_name="us-west-2") - create_secret = conn.create_secret(Name="java-util-test-password") + conn.create_secret(Name="java-util-test-password") with pytest.raises(ClientError) as cm: - result = conn.get_secret_value(SecretId="java-util-test-password") + conn.get_secret_value(SecretId="java-util-test-password") assert ( "Secrets Manager can't find the specified secret value for staging label: AWSCURRENT" @@ -256,9 +247,7 @@ def test_delete_secret_that_does_not_exist(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(ClientError): - result = conn.delete_secret( - SecretId="i-dont-exist", ForceDeleteWithoutRecovery=True - ) + conn.delete_secret(SecretId="i-dont-exist", ForceDeleteWithoutRecovery=True) @mock_secretsmanager @@ -268,7 +257,7 @@ def test_delete_secret_fails_with_both_force_delete_flag_and_recovery_window_fla conn.create_secret(Name="test-secret", SecretString="foosecret") with pytest.raises(ClientError): - result = conn.delete_secret( + conn.delete_secret( SecretId="test-secret", RecoveryWindowInDays=1, ForceDeleteWithoutRecovery=True, @@ -282,7 +271,7 @@ def test_delete_secret_recovery_window_too_short(): conn.create_secret(Name="test-secret", SecretString="foosecret") with pytest.raises(ClientError): - result = conn.delete_secret(SecretId="test-secret", RecoveryWindowInDays=6) + conn.delete_secret(SecretId="test-secret", RecoveryWindowInDays=6) @mock_secretsmanager @@ -292,7 +281,7 @@ def test_delete_secret_recovery_window_too_long(): conn.create_secret(Name="test-secret", SecretString="foosecret") with pytest.raises(ClientError): - result = conn.delete_secret(SecretId="test-secret", RecoveryWindowInDays=31) + conn.delete_secret(SecretId="test-secret", RecoveryWindowInDays=31) @mock_secretsmanager @@ -301,10 +290,10 @@ def test_delete_secret_that_is_marked_deleted(): conn.create_secret(Name="test-secret", SecretString="foosecret") - deleted_secret = conn.delete_secret(SecretId="test-secret") + conn.delete_secret(SecretId="test-secret") with pytest.raises(ClientError): - result = conn.delete_secret(SecretId="test-secret") + conn.delete_secret(SecretId="test-secret") @mock_secretsmanager @@ -415,7 +404,7 @@ def test_get_random_too_short_password(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(ClientError): - random_password = conn.get_random_password(PasswordLength=3) + conn.get_random_password(PasswordLength=3) @mock_secretsmanager @@ -423,7 +412,7 @@ def test_get_random_too_long_password(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(Exception): - random_password = conn.get_random_password(PasswordLength=5555) + conn.get_random_password(PasswordLength=5555) @mock_secretsmanager @@ -476,7 +465,7 @@ def test_describe_secret_that_does_not_exist(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(ClientError): - result = conn.get_secret_value(SecretId="i-dont-exist") + conn.get_secret_value(SecretId="i-dont-exist") @mock_secretsmanager @@ -485,7 +474,7 @@ def test_describe_secret_that_does_not_match(): conn.create_secret(Name="test-secret", SecretString="foosecret") with pytest.raises(ClientError): - result = conn.get_secret_value(SecretId="i-dont-match") + conn.get_secret_value(SecretId="i-dont-match") @mock_secretsmanager @@ -523,7 +512,7 @@ def test_restore_secret_that_does_not_exist(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(ClientError): - result = conn.restore_secret(SecretId="i-dont-exist") + conn.restore_secret(SecretId="i-dont-exist") @mock_secretsmanager @@ -574,7 +563,7 @@ def test_rotate_secret_that_is_marked_deleted(): conn.delete_secret(SecretId="test-secret") with pytest.raises(ClientError): - result = conn.rotate_secret(SecretId="test-secret") + conn.rotate_secret(SecretId="test-secret") @mock_secretsmanager @@ -582,7 +571,7 @@ def test_rotate_secret_that_does_not_exist(): conn = boto3.client("secretsmanager", "us-west-2") with pytest.raises(ClientError): - result = conn.rotate_secret(SecretId="i-dont-exist") + conn.rotate_secret(SecretId="i-dont-exist") @mock_secretsmanager @@ -591,7 +580,7 @@ def test_rotate_secret_that_does_not_match(): conn.create_secret(Name="test-secret", SecretString="foosecret") with pytest.raises(ClientError): - result = conn.rotate_secret(SecretId="i-dont-match") + conn.rotate_secret(SecretId="i-dont-match") @mock_secretsmanager @@ -611,7 +600,7 @@ def test_rotate_secret_client_request_token_too_long(): "ED9F8B6C-85B7-446A-B7E4-38F2A3BEB13C-" "ED9F8B6C-85B7-446A-B7E4-38F2A3BEB13C" ) with pytest.raises(ClientError): - result = conn.rotate_secret( + conn.rotate_secret( SecretId=DEFAULT_SECRET_NAME, ClientRequestToken=client_request_token ) @@ -623,7 +612,7 @@ def test_rotate_secret_rotation_lambda_arn_too_long(): rotation_lambda_arn = "85B7-446A-B7E4" * 147 # == 2058 characters with pytest.raises(ClientError): - result = conn.rotate_secret( + conn.rotate_secret( SecretId=DEFAULT_SECRET_NAME, RotationLambdaARN=rotation_lambda_arn ) @@ -643,9 +632,7 @@ def test_rotate_secret_rotation_period_too_long(): rotation_rules = {"AutomaticallyAfterDays": 1001} with pytest.raises(ClientError): - result = conn.rotate_secret( - SecretId=DEFAULT_SECRET_NAME, RotationRules=rotation_rules - ) + conn.rotate_secret(SecretId=DEFAULT_SECRET_NAME, RotationRules=rotation_rules) def get_rotation_zip_file(): @@ -1056,9 +1043,7 @@ def test_update_secret_which_does_not_exit(): conn = boto3.client("secretsmanager", region_name="us-west-2") with pytest.raises(ClientError) as cm: - updated_secret = conn.update_secret( - SecretId="test-secret", SecretString="barsecret" - ) + conn.update_secret(SecretId="test-secret", SecretString="barsecret") assert ( "Secrets Manager can't find the specified secret." @@ -1070,13 +1055,11 @@ def test_update_secret_which_does_not_exit(): def test_update_secret_marked_as_deleted(): conn = boto3.client("secretsmanager", region_name="us-west-2") - created_secret = conn.create_secret(Name="test-secret", SecretString="foosecret") - deleted_secret = conn.delete_secret(SecretId="test-secret") + conn.create_secret(Name="test-secret", SecretString="foosecret") + conn.delete_secret(SecretId="test-secret") with pytest.raises(ClientError) as cm: - updated_secret = conn.update_secret( - SecretId="test-secret", SecretString="barsecret" - ) + conn.update_secret(SecretId="test-secret", SecretString="barsecret") assert ( "because it was marked for deletion." in cm.value.response["Error"]["Message"] @@ -1087,9 +1070,9 @@ def test_update_secret_marked_as_deleted(): def test_update_secret_marked_as_deleted_after_restoring(): conn = boto3.client("secretsmanager", region_name="us-west-2") - created_secret = conn.create_secret(Name="test-secret", SecretString="foosecret") - deleted_secret = conn.delete_secret(SecretId="test-secret") - restored_secret = conn.restore_secret(SecretId="test-secret") + conn.create_secret(Name="test-secret", SecretString="foosecret") + conn.delete_secret(SecretId="test-secret") + conn.restore_secret(SecretId="test-secret") updated_secret = conn.update_secret( SecretId="test-secret", SecretString="barsecret" diff --git a/tests/test_secretsmanager/test_server.py b/tests/test_secretsmanager/test_server.py index a7c63e4b6..bbe95f36f 100644 --- a/tests/test_secretsmanager/test_server.py +++ b/tests/test_secretsmanager/test_server.py @@ -1,20 +1,14 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - import json import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server from moto import mock_secretsmanager, mock_lambda, mock_iam, mock_logs, settings from tests.test_awslambda.test_lambda import get_test_zip_file1 -""" -Test the different server responses for secretsmanager -""" - DEFAULT_SECRET_NAME = "test-secret" @@ -24,7 +18,7 @@ def test_get_secret_value(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foo-secret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -61,7 +55,7 @@ def test_get_secret_that_does_not_match(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foo-secret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -81,7 +75,7 @@ def test_get_secret_that_has_no_value(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -132,7 +126,7 @@ def test_describe_secret(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": "test-secret", "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -143,7 +137,7 @@ def test_describe_secret(): headers={"X-Amz-Target": "secretsmanager.DescribeSecret"}, ) - create_secret_2 = test_client.post( + test_client.post( "/", data={"Name": "test-secret-2", "SecretString": "barsecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -188,7 +182,7 @@ def test_describe_secret_that_does_not_match(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -209,7 +203,7 @@ def test_rotate_secret(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -311,7 +305,7 @@ def test_rotate_secret_that_does_not_match(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -381,7 +375,7 @@ def test_rotate_secret_client_request_token_too_short(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -407,7 +401,7 @@ def test_rotate_secret_client_request_token_too_long(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -435,7 +429,7 @@ def test_rotate_secret_rotation_lambda_arn_too_long(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": DEFAULT_SECRET_NAME, "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, @@ -737,7 +731,7 @@ def test_get_resource_policy_secret(): backend = server.create_backend_app("secretsmanager") test_client = backend.test_client() - create_secret = test_client.post( + test_client.post( "/", data={"Name": "test-secret", "SecretString": "foosecret"}, headers={"X-Amz-Target": "secretsmanager.CreateSecret"}, diff --git a/tests/test_ses/test_server.py b/tests/test_ses/test_server.py index b9d2252ce..f6ea72b59 100644 --- a/tests/test_ses/test_server.py +++ b/tests/test_ses/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_ses/test_ses.py b/tests/test_ses/test_ses.py index 776d6dc8f..3ab581c7f 100644 --- a/tests/test_ses/test_ses.py +++ b/tests/test_ses/test_ses.py @@ -1,10 +1,9 @@ -from __future__ import unicode_literals import email import boto from boto.exception import BotoServerError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ses_deprecated diff --git a/tests/test_ses/test_ses_boto3.py b/tests/test_ses/test_ses_boto3.py index 8a43eaf5d..dcb15cbd3 100644 --- a/tests/test_ses/test_ses_boto3.py +++ b/tests/test_ses/test_ses_boto3.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import json import boto3 @@ -7,8 +6,7 @@ from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import pytest - -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ses diff --git a/tests/test_ses/test_ses_sns_boto3.py b/tests/test_ses/test_ses_sns_boto3.py index 9676db371..b24ddeb8a 100644 --- a/tests/test_ses/test_ses_sns_boto3.py +++ b/tests/test_ses/test_ses_sns_boto3.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals - import boto3 import json -from botocore.exceptions import ClientError -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_ses, mock_sns, mock_sqs from moto.ses.models import SESFeedback from moto.core import ACCOUNT_ID diff --git a/tests/test_sns/test_application.py b/tests/test_sns/test_application.py index 06e8ea788..9c9a9251b 100644 --- a/tests/test_sns/test_application.py +++ b/tests/test_sns/test_application.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import boto from boto.exception import BotoServerError from moto import mock_sns_deprecated from moto.core import ACCOUNT_ID -import sure # noqa +import sure # noqa # pylint: disable=unused-import # Has boto3 equivalent diff --git a/tests/test_sns/test_application_boto3.py b/tests/test_sns/test_application_boto3.py index 148bb6162..8c31f217d 100644 --- a/tests/test_sns/test_application_boto3.py +++ b/tests/test_sns/test_application_boto3.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - import boto3 from botocore.exceptions import ClientError from moto import mock_sns -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.core import ACCOUNT_ID import pytest @@ -145,14 +143,14 @@ def test_create_duplicate_platform_endpoint(): ) application_arn = platform_application["PlatformApplicationArn"] - endpoint = conn.create_platform_endpoint( + conn.create_platform_endpoint( PlatformApplicationArn=application_arn, Token="some_unique_id", CustomUserData="some user data", Attributes={"Enabled": "false"}, ) - endpoint = conn.create_platform_endpoint.when.called_with( + conn.create_platform_endpoint.when.called_with( PlatformApplicationArn=application_arn, Token="some_unique_id", CustomUserData="some user data", diff --git a/tests/test_sns/test_publishing.py b/tests/test_sns/test_publishing.py index 30ca387d1..98aea11ac 100644 --- a/tests/test_sns/test_publishing.py +++ b/tests/test_sns/test_publishing.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals - import boto -import json import re from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sns_deprecated, mock_sqs_deprecated from moto.core import ACCOUNT_ID diff --git a/tests/test_sns/test_publishing_boto3.py b/tests/test_sns/test_publishing_boto3.py index 4a1a647c6..0d50fc2ed 100644 --- a/tests/test_sns/test_publishing_boto3.py +++ b/tests/test_sns/test_publishing_boto3.py @@ -1,12 +1,10 @@ -from __future__ import unicode_literals - import base64 import json import boto3 import re from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest @@ -413,13 +411,13 @@ def _setup_filter_policy_test(filter_policy): AttributeName="FilterPolicy", AttributeValue=json.dumps(filter_policy) ) - return topic, subscription, queue + return topic, queue @mock_sqs @mock_sns def test_filtering_exact_string(): - topic, subscription, queue = _setup_filter_policy_test({"store": ["example_corp"]}) + topic, queue = _setup_filter_policy_test({"store": ["example_corp"]}) topic.publish( Message="match", @@ -440,7 +438,7 @@ def test_filtering_exact_string(): @mock_sqs @mock_sns def test_filtering_exact_string_multiple_message_attributes(): - topic, subscription, queue = _setup_filter_policy_test({"store": ["example_corp"]}) + topic, queue = _setup_filter_policy_test({"store": ["example_corp"]}) topic.publish( Message="match", @@ -467,7 +465,7 @@ def test_filtering_exact_string_multiple_message_attributes(): @mock_sqs @mock_sns def test_filtering_exact_string_OR_matching(): - topic, subscription, queue = _setup_filter_policy_test( + topic, queue = _setup_filter_policy_test( {"store": ["example_corp", "different_corp"]} ) @@ -498,7 +496,7 @@ def test_filtering_exact_string_OR_matching(): @mock_sqs @mock_sns def test_filtering_exact_string_AND_matching_positive(): - topic, subscription, queue = _setup_filter_policy_test( + topic, queue = _setup_filter_policy_test( {"store": ["example_corp"], "event": ["order_cancelled"]} ) @@ -527,7 +525,7 @@ def test_filtering_exact_string_AND_matching_positive(): @mock_sqs @mock_sns def test_filtering_exact_string_AND_matching_no_match(): - topic, subscription, queue = _setup_filter_policy_test( + topic, queue = _setup_filter_policy_test( {"store": ["example_corp"], "event": ["order_cancelled"]} ) @@ -549,7 +547,7 @@ def test_filtering_exact_string_AND_matching_no_match(): @mock_sqs @mock_sns def test_filtering_exact_string_no_match(): - topic, subscription, queue = _setup_filter_policy_test({"store": ["example_corp"]}) + topic, queue = _setup_filter_policy_test({"store": ["example_corp"]}) topic.publish( Message="no match", @@ -568,7 +566,7 @@ def test_filtering_exact_string_no_match(): @mock_sqs @mock_sns def test_filtering_exact_string_no_attributes_no_match(): - topic, subscription, queue = _setup_filter_policy_test({"store": ["example_corp"]}) + topic, queue = _setup_filter_policy_test({"store": ["example_corp"]}) topic.publish(Message="no match") @@ -582,7 +580,7 @@ def test_filtering_exact_string_no_attributes_no_match(): @mock_sqs @mock_sns def test_filtering_exact_number_int(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100]}) + topic, queue = _setup_filter_policy_test({"price": [100]}) topic.publish( Message="match", @@ -599,7 +597,7 @@ def test_filtering_exact_number_int(): @mock_sqs @mock_sns def test_filtering_exact_number_float(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100.1]}) + topic, queue = _setup_filter_policy_test({"price": [100.1]}) topic.publish( Message="match", @@ -616,7 +614,7 @@ def test_filtering_exact_number_float(): @mock_sqs @mock_sns def test_filtering_exact_number_float_accuracy(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100.123456789]}) + topic, queue = _setup_filter_policy_test({"price": [100.123456789]}) topic.publish( Message="match", @@ -637,7 +635,7 @@ def test_filtering_exact_number_float_accuracy(): @mock_sqs @mock_sns def test_filtering_exact_number_no_match(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100]}) + topic, queue = _setup_filter_policy_test({"price": [100]}) topic.publish( Message="no match", @@ -654,7 +652,7 @@ def test_filtering_exact_number_no_match(): @mock_sqs @mock_sns def test_filtering_exact_number_with_string_no_match(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100]}) + topic, queue = _setup_filter_policy_test({"price": [100]}) topic.publish( Message="no match", @@ -671,7 +669,7 @@ def test_filtering_exact_number_with_string_no_match(): @mock_sqs @mock_sns def test_filtering_string_array_match(): - topic, subscription, queue = _setup_filter_policy_test( + topic, queue = _setup_filter_policy_test( {"customer_interests": ["basketball", "baseball"]} ) @@ -704,9 +702,7 @@ def test_filtering_string_array_match(): @mock_sqs @mock_sns def test_filtering_string_array_no_match(): - topic, subscription, queue = _setup_filter_policy_test( - {"customer_interests": ["baseball"]} - ) + topic, queue = _setup_filter_policy_test({"customer_interests": ["baseball"]}) topic.publish( Message="no_match", @@ -728,7 +724,7 @@ def test_filtering_string_array_no_match(): @mock_sqs @mock_sns def test_filtering_string_array_with_number_match(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100, 500]}) + topic, queue = _setup_filter_policy_test({"price": [100, 500]}) topic.publish( Message="match", @@ -749,9 +745,7 @@ def test_filtering_string_array_with_number_match(): @mock_sqs @mock_sns def test_filtering_string_array_with_number_float_accuracy_match(): - topic, subscription, queue = _setup_filter_policy_test( - {"price": [100.123456789, 500]} - ) + topic, queue = _setup_filter_policy_test({"price": [100.123456789, 500]}) topic.publish( Message="match", @@ -776,7 +770,7 @@ def test_filtering_string_array_with_number_float_accuracy_match(): @mock_sns # this is the correct behavior from SNS def test_filtering_string_array_with_number_no_array_match(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100, 500]}) + topic, queue = _setup_filter_policy_test({"price": [100, 500]}) topic.publish( Message="match", @@ -795,7 +789,7 @@ def test_filtering_string_array_with_number_no_array_match(): @mock_sqs @mock_sns def test_filtering_string_array_with_number_no_match(): - topic, subscription, queue = _setup_filter_policy_test({"price": [500]}) + topic, queue = _setup_filter_policy_test({"price": [500]}) topic.publish( Message="no_match", @@ -815,7 +809,7 @@ def test_filtering_string_array_with_number_no_match(): @mock_sns # this is the correct behavior from SNS def test_filtering_string_array_with_string_no_array_no_match(): - topic, subscription, queue = _setup_filter_policy_test({"price": [100]}) + topic, queue = _setup_filter_policy_test({"price": [100]}) topic.publish( Message="no_match", @@ -834,9 +828,7 @@ def test_filtering_string_array_with_string_no_array_no_match(): @mock_sqs @mock_sns def test_filtering_attribute_key_exists_match(): - topic, subscription, queue = _setup_filter_policy_test( - {"store": [{"exists": True}]} - ) + topic, queue = _setup_filter_policy_test({"store": [{"exists": True}]}) topic.publish( Message="match", @@ -857,9 +849,7 @@ def test_filtering_attribute_key_exists_match(): @mock_sqs @mock_sns def test_filtering_attribute_key_exists_no_match(): - topic, subscription, queue = _setup_filter_policy_test( - {"store": [{"exists": True}]} - ) + topic, queue = _setup_filter_policy_test({"store": [{"exists": True}]}) topic.publish( Message="no match", @@ -878,9 +868,7 @@ def test_filtering_attribute_key_exists_no_match(): @mock_sqs @mock_sns def test_filtering_attribute_key_not_exists_match(): - topic, subscription, queue = _setup_filter_policy_test( - {"store": [{"exists": False}]} - ) + topic, queue = _setup_filter_policy_test({"store": [{"exists": False}]}) topic.publish( Message="match", @@ -901,9 +889,7 @@ def test_filtering_attribute_key_not_exists_match(): @mock_sqs @mock_sns def test_filtering_attribute_key_not_exists_no_match(): - topic, subscription, queue = _setup_filter_policy_test( - {"store": [{"exists": False}]} - ) + topic, queue = _setup_filter_policy_test({"store": [{"exists": False}]}) topic.publish( Message="no match", @@ -922,7 +908,7 @@ def test_filtering_attribute_key_not_exists_no_match(): @mock_sqs @mock_sns def test_filtering_all_AND_matching_match(): - topic, subscription, queue = _setup_filter_policy_test( + topic, queue = _setup_filter_policy_test( { "store": [{"exists": True}], "event": ["order_cancelled"], @@ -966,7 +952,7 @@ def test_filtering_all_AND_matching_match(): @mock_sqs @mock_sns def test_filtering_all_AND_matching_no_match(): - topic, subscription, queue = _setup_filter_policy_test( + topic, queue = _setup_filter_policy_test( { "store": [{"exists": True}], "event": ["order_cancelled"], diff --git a/tests/test_sns/test_server.py b/tests/test_sns/test_server.py index 78bc147df..40ca1c2e0 100644 --- a/tests/test_sns/test_server.py +++ b/tests/test_sns/test_server.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals from moto.core import ACCOUNT_ID -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_sns/test_sns_cloudformation.py b/tests/test_sns/test_sns_cloudformation.py index 2369a84ad..17cd25e05 100644 --- a/tests/test_sns/test_sns_cloudformation.py +++ b/tests/test_sns/test_sns_cloudformation.py @@ -1,6 +1,6 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_cloudformation, mock_sns diff --git a/tests/test_sns/test_subscriptions.py b/tests/test_sns/test_subscriptions.py index 61e1adaac..e6631df40 100644 --- a/tests/test_sns/test_subscriptions.py +++ b/tests/test_sns/test_subscriptions.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals import boto -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sns_deprecated from moto.sns.models import DEFAULT_PAGE_SIZE diff --git a/tests/test_sns/test_subscriptions_boto3.py b/tests/test_sns/test_subscriptions_boto3.py index d312979f8..1e1bf4f63 100644 --- a/tests/test_sns/test_subscriptions_boto3.py +++ b/tests/test_sns/test_subscriptions_boto3.py @@ -1,8 +1,7 @@ -from __future__ import unicode_literals import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest diff --git a/tests/test_sns/test_topics.py b/tests/test_sns/test_topics.py index 301d7a57d..67181739f 100644 --- a/tests/test_sns/test_topics.py +++ b/tests/test_sns/test_topics.py @@ -1,8 +1,7 @@ -from __future__ import unicode_literals import boto import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto.exception import BotoServerError from moto import mock_sns_deprecated diff --git a/tests/test_sns/test_topics_boto3.py b/tests/test_sns/test_topics_boto3.py index 875d4f181..d11f75602 100644 --- a/tests/test_sns/test_topics_boto3.py +++ b/tests/test_sns/test_topics_boto3.py @@ -1,8 +1,7 @@ -from __future__ import unicode_literals import boto3 import json -# import sure # noqa +# import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError from moto import mock_sns diff --git a/tests/test_sqs/test_integration.py b/tests/test_sqs/test_integration.py index fea5f7f6a..d93570052 100644 --- a/tests/test_sqs/test_integration.py +++ b/tests/test_sqs/test_integration.py @@ -1,15 +1,9 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -import base64 import json import time import uuid -import hashlib -import boto import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sqs, mock_lambda, mock_logs from tests.test_awslambda.test_lambda import get_test_zip_file1, get_role_name diff --git a/tests/test_sqs/test_server.py b/tests/test_sqs/test_server.py index 0116a93ef..d8f068ab5 100644 --- a/tests/test_sqs/test_server.py +++ b/tests/test_sqs/test_server.py @@ -1,7 +1,5 @@ -from __future__ import unicode_literals - import re -import sure # noqa +import sure # noqa # pylint: disable=unused-import import threading import time diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py index 1f234833e..16f81e8a5 100644 --- a/tests/test_sqs/test_sqs.py +++ b/tests/test_sqs/test_sqs.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - import base64 import json import time @@ -10,7 +7,7 @@ import hashlib import boto import boto3 import botocore.exceptions -import sure # noqa +import sure # noqa # pylint: disable=unused-import from boto.exception import SQSError from boto.sqs.message import Message, RawMessage from botocore.exceptions import ClientError @@ -542,7 +539,7 @@ def test_send_message_with_message_group_id(): QueueName=f"{str(uuid4())[0:6]}.fifo", Attributes={"FifoQueue": "true"} ) - sent = queue.send_message( + queue.send_message( MessageBody="mydata", MessageDeduplicationId="dedupe_id_1", MessageGroupId="group_id_1", @@ -566,7 +563,7 @@ def test_send_message_with_unicode_characters(): sqs = boto3.resource("sqs", region_name="us-east-1") queue = sqs.create_queue(QueueName=str(uuid4())[0:6]) - msg = queue.send_message(MessageBody=body_one) + queue.send_message(MessageBody=body_one) messages = queue.receive_messages() message_body = messages[0].body @@ -2014,7 +2011,7 @@ def test_purge_queue_before_delete_message(): MessageDeduplicationId="first_message", MessageBody="first_message", ) - receive_resp1 = client.receive_message(QueueUrl=queue_url) + client.receive_message(QueueUrl=queue_url) # purge before call delete_message client.purge_queue(QueueUrl=queue_url) @@ -3272,9 +3269,10 @@ def test_receive_message_should_not_accept_invalid_urls(): conn = boto3.client("sqs", region_name="us-east-1") name = str(uuid4())[0:6] q_response = conn.create_queue(QueueName=name) - working_url = q_response[ - "QueueUrl" - ] # https://queue.amazonaws.com/486285699788/test-queue + working_url = q_response["QueueUrl"] + # https://queue.amazonaws.com/012341234/test-queue + # http://localhost:5000/012341234/test-queue in ServerMode + working_url.should.match(f"/{ACCOUNT_ID}/{name}") queue = sqs.Queue(name) with pytest.raises(ClientError) as e: diff --git a/tests/test_sqs/test_sqs_cloudformation.py b/tests/test_sqs/test_sqs_cloudformation.py index 8f9bc5cad..c3614a475 100644 --- a/tests/test_sqs/test_sqs_cloudformation.py +++ b/tests/test_sqs/test_sqs_cloudformation.py @@ -1,7 +1,7 @@ import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sqs, mock_cloudformation from moto.core import ACCOUNT_ID from string import Template diff --git a/tests/test_ssm/test_ssm_boto3.py b/tests/test_ssm/test_ssm_boto3.py index 70e49a4a5..2972c632e 100644 --- a/tests/test_ssm/test_ssm_boto3.py +++ b/tests/test_ssm/test_ssm_boto3.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import string import boto3 import botocore.exceptions -import sure # noqa +import sure # noqa # pylint: disable=unused-import import datetime import uuid diff --git a/tests/test_ssm/test_ssm_cloudformation.py b/tests/test_ssm/test_ssm_cloudformation.py index 8530d7135..b1922027f 100644 --- a/tests/test_ssm/test_ssm_cloudformation.py +++ b/tests/test_ssm/test_ssm_cloudformation.py @@ -40,7 +40,7 @@ def test_get_command_invocations_from_stack(): stack_template_str = json.dumps(stack_template) - response = cloudformation_client.create_stack( + cloudformation_client.create_stack( StackName="test_stack", TemplateBody=stack_template_str, Capabilities=("CAPABILITY_IAM",), @@ -66,6 +66,6 @@ def test_get_command_invocations_from_stack(): cmd_id = cmd["CommandId"] instance_ids = cmd["InstanceIds"] - invocation_response = client.get_command_invocation( + client.get_command_invocation( CommandId=cmd_id, InstanceId=instance_ids[0], PluginName="aws:runShellScript" ) diff --git a/tests/test_ssm/test_ssm_docs.py b/tests/test_ssm/test_ssm_docs.py index 43a9120cf..2ac44da28 100644 --- a/tests/test_ssm/test_ssm_docs.py +++ b/tests/test_ssm/test_ssm_docs.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import botocore.exceptions -import sure # noqa +import sure # noqa # pylint: disable=unused-import import datetime from datetime import timezone import json diff --git a/tests/test_stepfunctions/test_stepfunctions.py b/tests/test_stepfunctions/test_stepfunctions.py index 6d7234585..532d9e1df 100644 --- a/tests/test_stepfunctions/test_stepfunctions.py +++ b/tests/test_stepfunctions/test_stepfunctions.py @@ -1,9 +1,7 @@ -from __future__ import unicode_literals - import boto3 import json import os -import sure # noqa +import sure # noqa # pylint: disable=unused-import from datetime import datetime from dateutil.tz import tzutc from botocore.exceptions import ClientError @@ -189,8 +187,8 @@ def test_update_state_machine(): def test_state_machine_list_returns_empty_list_by_default(): client = boto3.client("stepfunctions", region_name=region) # - list = client.list_state_machines() - list["stateMachines"].should.be.empty + sm_list = client.list_state_machines() + sm_list["stateMachines"].should.be.empty @mock_stepfunctions @@ -207,20 +205,20 @@ def test_state_machine_list_returns_created_state_machines(): machine2 = client.create_state_machine( name="name2", definition=str(simple_definition), roleArn=_get_default_role() ) - list = client.list_state_machines() + sm_list = client.list_state_machines() # - list["ResponseMetadata"]["HTTPStatusCode"].should.equal(200) - list["stateMachines"].should.have.length_of(2) - list["stateMachines"][0]["creationDate"].should.be.a(datetime) - list["stateMachines"][0]["creationDate"].should.equal(machine1["creationDate"]) - list["stateMachines"][0]["name"].should.equal("name1") - list["stateMachines"][0]["stateMachineArn"].should.equal( + sm_list["ResponseMetadata"]["HTTPStatusCode"].should.equal(200) + sm_list["stateMachines"].should.have.length_of(2) + sm_list["stateMachines"][0]["creationDate"].should.be.a(datetime) + sm_list["stateMachines"][0]["creationDate"].should.equal(machine1["creationDate"]) + sm_list["stateMachines"][0]["name"].should.equal("name1") + sm_list["stateMachines"][0]["stateMachineArn"].should.equal( machine1["stateMachineArn"] ) - list["stateMachines"][1]["creationDate"].should.be.a(datetime) - list["stateMachines"][1]["creationDate"].should.equal(machine2["creationDate"]) - list["stateMachines"][1]["name"].should.equal("name2") - list["stateMachines"][1]["stateMachineArn"].should.equal( + sm_list["stateMachines"][1]["creationDate"].should.be.a(datetime) + sm_list["stateMachines"][1]["creationDate"].should.equal(machine2["creationDate"]) + sm_list["stateMachines"][1]["name"].should.equal("name2") + sm_list["stateMachines"][1]["stateMachineArn"].should.equal( machine2["stateMachineArn"] ) diff --git a/tests/test_stepfunctions/test_stepfunctions_cloudformation.py b/tests/test_stepfunctions/test_stepfunctions_cloudformation.py index 8a7d8f3db..3e2aef855 100644 --- a/tests/test_stepfunctions/test_stepfunctions_cloudformation.py +++ b/tests/test_stepfunctions/test_stepfunctions_cloudformation.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import json -import sure # noqa +import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError import pytest diff --git a/tests/test_sts/test_server.py b/tests/test_sts/test_server.py index 8903477d7..1c67970c9 100644 --- a/tests/test_sts/test_server.py +++ b/tests/test_sts/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_sts/test_sts.py b/tests/test_sts/test_sts.py index f8aedebf2..b5d5286be 100644 --- a/tests/test_sts/test_sts.py +++ b/tests/test_sts/test_sts.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from base64 import b64encode import json @@ -8,7 +7,7 @@ from botocore.client import ClientError from datetime import datetime from freezegun import freeze_time import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_sts, mock_sts_deprecated, mock_iam, settings from moto.core import ACCOUNT_ID diff --git a/tests/test_support/test_server.py b/tests/test_support/test_server.py index 82f281565..f9b7e6268 100644 --- a/tests/test_support/test_server.py +++ b/tests/test_support/test_server.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import moto.server as server diff --git a/tests/test_support/test_support.py b/tests/test_support/test_support.py index 189062005..473bf9f3f 100644 --- a/tests/test_support/test_support.py +++ b/tests/test_support/test_support.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - import boto3 import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_support @@ -89,7 +87,7 @@ def test_refresh_trusted_advisor_check_cycles_to_new_status_on_each_call( check_name = "XXXIIIY" actual_statuses = [] - for status in possible_statuses: + for _ in possible_statuses: response = client.refresh_trusted_advisor_check(checkId=check_name) actual_statuses.append(response["status"]["status"]) @@ -114,11 +112,11 @@ def test_refresh_trusted_advisor_check_cycles_to_new_status_on_with_two_checks() "abandoned", ] - for check in possible_statuses: + for _ in possible_statuses: response = client.refresh_trusted_advisor_check(checkId=check_1_name) check_1_statuses.append(response["status"]["status"]) - for check in possible_statuses: + for _ in possible_statuses: response = client.refresh_trusted_advisor_check(checkId=check_2_name) check_2_statuses.append(response["status"]["status"]) @@ -143,7 +141,7 @@ def test_refresh_trusted_advisor_check_cycle_continues_on_full_cycle(): "abandoned", ] - for status in possible_statuses: + for _ in possible_statuses: client.refresh_trusted_advisor_check(checkId=check_name) expected_none_response = client.refresh_trusted_advisor_check(checkId=check_name) diff --git a/tests/test_swf/models/test_activity_task.py b/tests/test_swf/models/test_activity_task.py index bedbaade0..0613e4e37 100644 --- a/tests/test_swf/models/test_activity_task.py +++ b/tests/test_swf/models/test_activity_task.py @@ -1,5 +1,5 @@ from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.swf.exceptions import SWFWorkflowExecutionClosedError from moto.swf.models import ActivityTask, ActivityType, Timeout diff --git a/tests/test_swf/models/test_decision_task.py b/tests/test_swf/models/test_decision_task.py index 8ddb230e2..473016781 100644 --- a/tests/test_swf/models/test_decision_task.py +++ b/tests/test_swf/models/test_decision_task.py @@ -1,6 +1,4 @@ -from boto.swf.exceptions import SWFResponseError from freezegun import freeze_time -from sure import expect from moto.swf.models import DecisionTask, Timeout from moto.swf.exceptions import SWFWorkflowExecutionClosedError diff --git a/tests/test_swf/models/test_domain.py b/tests/test_swf/models/test_domain.py index dac8902a7..31a840217 100644 --- a/tests/test_swf/models/test_domain.py +++ b/tests/test_swf/models/test_domain.py @@ -1,5 +1,5 @@ from collections import namedtuple -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.core import ACCOUNT_ID from moto.swf.exceptions import SWFUnknownResourceFault diff --git a/tests/test_swf/models/test_generic_type.py b/tests/test_swf/models/test_generic_type.py index ef7378d06..f719c9d44 100644 --- a/tests/test_swf/models/test_generic_type.py +++ b/tests/test_swf/models/test_generic_type.py @@ -1,5 +1,5 @@ from moto.swf.models import GenericType -import sure # noqa +import sure # noqa # pylint: disable=unused-import # Tests for GenericType (ActivityType, WorkflowType) diff --git a/tests/test_swf/models/test_history_event.py b/tests/test_swf/models/test_history_event.py index 8b8234187..0313d6947 100644 --- a/tests/test_swf/models/test_history_event.py +++ b/tests/test_swf/models/test_history_event.py @@ -1,5 +1,5 @@ from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.swf.models import HistoryEvent diff --git a/tests/test_swf/models/test_timeout.py b/tests/test_swf/models/test_timeout.py index 0ee059065..b076b3baf 100644 --- a/tests/test_swf/models/test_timeout.py +++ b/tests/test_swf/models/test_timeout.py @@ -1,5 +1,5 @@ from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.swf.models import Timeout diff --git a/tests/test_swf/models/test_workflow_execution.py b/tests/test_swf/models/test_workflow_execution.py index 503198f46..c3960d006 100644 --- a/tests/test_swf/models/test_workflow_execution.py +++ b/tests/test_swf/models/test_workflow_execution.py @@ -1,5 +1,5 @@ from freezegun import freeze_time -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.swf.models import ActivityType, Timeout, WorkflowType, WorkflowExecution from moto.swf.exceptions import SWFDefaultUndefinedFault diff --git a/tests/test_swf/responses/test_activity_tasks.py b/tests/test_swf/responses/test_activity_tasks.py index f23d146b9..8dc9ba81d 100644 --- a/tests/test_swf/responses/test_activity_tasks.py +++ b/tests/test_swf/responses/test_activity_tasks.py @@ -1,9 +1,9 @@ from boto.swf.exceptions import SWFResponseError from botocore.exceptions import ClientError from freezegun import freeze_time +import sure # noqa # pylint: disable=unused-import from unittest import SkipTest import pytest -import sure # noqa from moto import mock_swf, mock_swf_deprecated from moto import settings diff --git a/tests/test_swf/responses/test_activity_types.py b/tests/test_swf/responses/test_activity_types.py index 8e11ce778..a2ac5169f 100644 --- a/tests/test_swf/responses/test_activity_types.py +++ b/tests/test_swf/responses/test_activity_types.py @@ -2,8 +2,8 @@ import boto from boto.swf.exceptions import SWFResponseError import boto3 from botocore.exceptions import ClientError +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_swf_deprecated from moto import mock_swf diff --git a/tests/test_swf/responses/test_decision_tasks.py b/tests/test_swf/responses/test_decision_tasks.py index 944f0a10e..6b994d8a3 100644 --- a/tests/test_swf/responses/test_decision_tasks.py +++ b/tests/test_swf/responses/test_decision_tasks.py @@ -2,8 +2,8 @@ from boto.swf.exceptions import SWFResponseError from botocore.exceptions import ClientError from datetime import datetime from freezegun import freeze_time +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_swf_deprecated, mock_swf, settings from moto.swf import swf_backend diff --git a/tests/test_swf/responses/test_domains.py b/tests/test_swf/responses/test_domains.py index e0c70ce19..94c150230 100644 --- a/tests/test_swf/responses/test_domains.py +++ b/tests/test_swf/responses/test_domains.py @@ -2,8 +2,8 @@ import boto from boto.swf.exceptions import SWFResponseError import boto3 from botocore.exceptions import ClientError +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_swf_deprecated from moto import mock_swf diff --git a/tests/test_swf/responses/test_timeouts.py b/tests/test_swf/responses/test_timeouts.py index b26c3ea92..1cca20dd8 100644 --- a/tests/test_swf/responses/test_timeouts.py +++ b/tests/test_swf/responses/test_timeouts.py @@ -1,7 +1,7 @@ from datetime import datetime from freezegun import freeze_time +import sure # noqa # pylint: disable=unused-import from unittest import SkipTest -import sure # noqa from moto import mock_swf_deprecated, mock_swf, settings diff --git a/tests/test_swf/responses/test_workflow_executions.py b/tests/test_swf/responses/test_workflow_executions.py index fb94cf63c..e5e6a7b28 100644 --- a/tests/test_swf/responses/test_workflow_executions.py +++ b/tests/test_swf/responses/test_workflow_executions.py @@ -4,8 +4,8 @@ from boto.swf.exceptions import SWFResponseError from botocore.exceptions import ClientError from datetime import datetime, timedelta +import sure # noqa # pylint: disable=unused-import import pytest -import sure # noqa from moto import mock_swf_deprecated, mock_swf from moto.core.utils import unix_time diff --git a/tests/test_swf/responses/test_workflow_types.py b/tests/test_swf/responses/test_workflow_types.py index 347f85acb..91ff9ba6e 100644 --- a/tests/test_swf/responses/test_workflow_types.py +++ b/tests/test_swf/responses/test_workflow_types.py @@ -1,4 +1,4 @@ -import sure +import sure # noqa # pylint: disable=unused-import import boto import boto3 import pytest diff --git a/tests/test_swf/test_exceptions.py b/tests/test_swf/test_exceptions.py index 2e42cdb9b..fc7f32c23 100644 --- a/tests/test_swf/test_exceptions.py +++ b/tests/test_swf/test_exceptions.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -import sure # noqa +import sure # noqa # pylint: disable=unused-import import json diff --git a/tests/test_swf/test_utils.py b/tests/test_swf/test_utils.py index 143804ca9..f0b9152e1 100644 --- a/tests/test_swf/test_utils.py +++ b/tests/test_swf/test_utils.py @@ -1,4 +1,4 @@ -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto.swf.utils import decapitalize diff --git a/tests/test_transcribe/test_transcribe_boto3.py b/tests/test_transcribe/test_transcribe_boto3.py index 07f57f9d9..c23ab839b 100644 --- a/tests/test_transcribe/test_transcribe_boto3.py +++ b/tests/test_transcribe/test_transcribe_boto3.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals - import boto3 -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_transcribe diff --git a/tests/test_wafv2/test_server.py b/tests/test_wafv2/test_server.py index af441a9f6..c9bac1907 100644 --- a/tests/test_wafv2/test_server.py +++ b/tests/test_wafv2/test_server.py @@ -1,12 +1,5 @@ -from __future__ import unicode_literals -import json -import pytest +import sure # noqa # pylint: disable=unused-import -import sure # noqa - -import boto3 -import botocore -from botocore.exceptions import ClientError import moto.server as server from moto import mock_wafv2 from .test_helper_functions import CREATE_WEB_ACL_BODY, LIST_WEB_ACL_BODY diff --git a/tests/test_wafv2/test_utils.py b/tests/test_wafv2/test_utils.py index 39bd255b2..5482c751d 100644 --- a/tests/test_wafv2/test_utils.py +++ b/tests/test_wafv2/test_utils.py @@ -1,8 +1,5 @@ -import random -import string import uuid -from moto.wafv2 import utils from moto.wafv2.utils import make_arn_for_wacl from moto.core import ACCOUNT_ID diff --git a/tests/test_wafv2/test_wafv2.py b/tests/test_wafv2/test_wafv2.py index fd066909d..6bca57713 100644 --- a/tests/test_wafv2/test_wafv2.py +++ b/tests/test_wafv2/test_wafv2.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals -import json import pytest -import sure # noqa +import sure # noqa # pylint: disable=unused-import import boto3 from botocore.exceptions import ClientError from moto import mock_wafv2 diff --git a/tests/test_xray/test_xray_boto3.py b/tests/test_xray/test_xray_boto3.py index 4089abd2e..80c2629d9 100644 --- a/tests/test_xray/test_xray_boto3.py +++ b/tests/test_xray/test_xray_boto3.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals - import boto3 import json -import botocore.exceptions -import sure # noqa +import sure # noqa # pylint: disable=unused-import from moto import mock_xray diff --git a/tests/test_xray/test_xray_client.py b/tests/test_xray/test_xray_client.py index 6b74136c9..f28fcc064 100644 --- a/tests/test_xray/test_xray_client.py +++ b/tests/test_xray/test_xray_client.py @@ -1,6 +1,5 @@ -from __future__ import unicode_literals from moto import mock_xray_client, XRaySegment, mock_dynamodb2 -import sure # noqa +import sure # noqa # pylint: disable=unused-import import boto3 from moto.xray.mock_client import MockEmitter