Flake8 fixes

This commit is contained in:
Don Kuntz 2019-08-19 18:01:44 -05:00
parent 4929298f1f
commit d2ce3a9e04
No known key found for this signature in database
GPG Key ID: EBA7AEF98657FB2E
2 changed files with 7 additions and 6 deletions

View File

@ -37,7 +37,7 @@ def xml_serialize(tree, key, value):
elif isinstance(value, list):
for item in value:
xml_serialize(node, 'item', item)
elif value == None:
elif value is None:
pass
else:
raise NotImplementedError("Don't know how to serialize \"{}\" to xml".format(value.__class__))
@ -99,7 +99,6 @@ class LaunchTemplates(BaseResponse):
raw_template_data = self._get_dict_param('LaunchTemplateData.')
parsed_template_data = parse_object(raw_template_data)
if self.is_not_dryrun('CreateLaunchTemplate'):
if tag_spec:
if 'TagSpecifications' not in parsed_template_data:
@ -176,7 +175,6 @@ class LaunchTemplates(BaseResponse):
min_version = self._get_int_param("MinVersion")
max_version = self._get_int_param("MaxVersion")
filters = filters_from_querystring(self.querystring)
if filters:
raise FilterNotImplementedError("all filters", "DescribeLaunchTemplateVersions")

View File

@ -6,6 +6,7 @@ from botocore.client import ClientError
from moto import mock_ec2
@mock_ec2
def test_launch_template_create():
cli = boto3.client("ec2", region_name="us-east-1")
@ -89,6 +90,7 @@ def test_describe_launch_template_versions():
templ = resp["LaunchTemplateVersions"][0]["LaunchTemplateData"]
templ.should.equal(template_data)
@mock_ec2
def test_create_launch_template_version():
cli = boto3.client("ec2", region_name="us-east-1")
@ -113,6 +115,7 @@ def test_create_launch_template_version():
version["VersionDescription"].should.equal("new ami")
version["VersionNumber"].should.equal(2)
@mock_ec2
def test_create_launch_template_version_by_id():
cli = boto3.client("ec2", region_name="us-east-1")
@ -189,7 +192,7 @@ def test_describe_launch_template_versions_with_versions_option():
resp = cli.describe_launch_template_versions(
LaunchTemplateName="test-template",
Versions=["2","3"])
Versions=["2", "3"])
resp["LaunchTemplateVersions"].should.have.length_of(2)
resp["LaunchTemplateVersions"][0]["LaunchTemplateData"]["ImageId"].should.equal("ami-def456")
@ -303,7 +306,6 @@ def test_describe_launch_template_versions_with_min_and_max():
resp["LaunchTemplateVersions"][1]["LaunchTemplateData"]["ImageId"].should.equal("ami-hij789")
@mock_ec2
def test_describe_launch_templates():
cli = boto3.client("ec2", region_name="us-east-1")
@ -345,6 +347,7 @@ def test_describe_launch_templates():
resp["LaunchTemplates"][0]["LaunchTemplateName"].should.equal("test-template")
resp["LaunchTemplates"][1]["LaunchTemplateName"].should.equal("test-template2")
@mock_ec2
def test_describe_launch_templates_with_filters():
cli = boto3.client("ec2", region_name="us-east-1")
@ -388,7 +391,7 @@ def test_create_launch_template_with_tag_spec():
cli.create_launch_template(
LaunchTemplateName="test-template",
LaunchTemplateData={"ImageId":"ami-abc123"},
LaunchTemplateData={"ImageId": "ami-abc123"},
TagSpecifications=[{
"ResourceType": "instance",
"Tags": [