Merge pull request #686 from mervynrussell/feature/ami_creation_date

Feature/ami creation date
This commit is contained in:
Steve Pulec 2016-08-27 21:06:13 -04:00 committed by GitHub
commit 0a11db6a8c
3 changed files with 3 additions and 0 deletions

1
moto/ec2/models.py Normal file → Executable file
View File

@ -911,6 +911,7 @@ class Ami(TaggedEC2Resource):
self.architecture = None self.architecture = None
self.kernel_id = None self.kernel_id = None
self.platform = None self.platform = None
self.creation_date = datetime.utcnow().isoformat()
if instance: if instance:
self.instance = instance self.instance = instance

1
moto/ec2/responses/amis.py Normal file → Executable file
View File

@ -90,6 +90,7 @@ DESCRIBE_IMAGES_RESPONSE = """<DescribeImagesResponse xmlns="http://ec2.amazonaw
<kernelId>{{ image.kernel_id }}</kernelId> <kernelId>{{ image.kernel_id }}</kernelId>
<ramdiskId>ari-1a2b3c4d</ramdiskId> <ramdiskId>ari-1a2b3c4d</ramdiskId>
<imageOwnerAlias>amazon</imageOwnerAlias> <imageOwnerAlias>amazon</imageOwnerAlias>
<creationDate>{{ image.creation_date }}</creationDate>
<name>{{ image.name }}</name> <name>{{ image.name }}</name>
{% if image.platform %} {% if image.platform %}
<platform>{{ image.platform }}</platform> <platform>{{ image.platform }}</platform>

1
tests/test_ec2/test_amis.py Normal file → Executable file
View File

@ -28,6 +28,7 @@ def test_ami_create_and_delete():
image.architecture.should.equal(instance.architecture) image.architecture.should.equal(instance.architecture)
image.kernel_id.should.equal(instance.kernel) image.kernel_id.should.equal(instance.kernel)
image.platform.should.equal(instance.platform) image.platform.should.equal(instance.platform)
image.creationDate.should_not.be.none
instance.terminate() instance.terminate()
# Validate auto-created volume and snapshot # Validate auto-created volume and snapshot