From c51ce76ee9ccd64760157d2dde8158462dd7420b Mon Sep 17 00:00:00 2001 From: Berislav Kovacki Date: Tue, 9 Jul 2019 02:10:33 +0200 Subject: [PATCH] Add InstanceCreateTime to DBInstance --- moto/rds2/models.py | 4 +++- tests/test_rds2/test_rds2.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/moto/rds2/models.py b/moto/rds2/models.py index fee004f76..498f9b126 100644 --- a/moto/rds2/models.py +++ b/moto/rds2/models.py @@ -70,6 +70,7 @@ class Database(BaseModel): self.port = Database.default_port(self.engine) self.db_instance_identifier = kwargs.get('db_instance_identifier') self.db_name = kwargs.get("db_name") + self.instance_create_time = iso_8601_datetime_with_milliseconds(datetime.datetime.now()) self.publicly_accessible = kwargs.get("publicly_accessible") if self.publicly_accessible is None: self.publicly_accessible = True @@ -148,6 +149,7 @@ class Database(BaseModel): {{ database.db_instance_identifier }} {{ database.dbi_resource_id }} + {{ database.instance_create_time }} 03:50-04:20 wed:06:38-wed:07:08 @@ -373,7 +375,7 @@ class Database(BaseModel): "Address": "{{ database.address }}", "Port": "{{ database.port }}" }, - "InstanceCreateTime": null, + "InstanceCreateTime": "{{ database.instance_create_time }}", "Iops": null, "ReadReplicaDBInstanceIdentifiers": [{%- for replica in database.replicas -%} {%- if not loop.first -%},{%- endif -%} diff --git a/tests/test_rds2/test_rds2.py b/tests/test_rds2/test_rds2.py index a25b53196..cf5c9a906 100644 --- a/tests/test_rds2/test_rds2.py +++ b/tests/test_rds2/test_rds2.py @@ -34,6 +34,7 @@ def test_create_database(): db_instance['IAMDatabaseAuthenticationEnabled'].should.equal(False) db_instance['DbiResourceId'].should.contain("db-") db_instance['CopyTagsToSnapshot'].should.equal(False) + db_instance['InstanceCreateTime'].should.be.a("datetime.datetime") @mock_rds2