[Glue] fix return dates error on sdk . (#5912)
This commit is contained in:
parent
f78ced59b3
commit
c6c0e50ee9
@ -7,6 +7,7 @@ from typing import Dict, List
|
||||
from moto.core import BaseBackend, BackendDict, BaseModel
|
||||
from moto.moto_api import state_manager
|
||||
from moto.moto_api._internal import mock_random
|
||||
from moto.core.utils import unix_time
|
||||
from moto.moto_api._internal.managed_state_model import ManagedState
|
||||
from .exceptions import (
|
||||
JsonRESTError,
|
||||
@ -759,7 +760,7 @@ class FakeDatabase(BaseModel):
|
||||
"Description": self.input.get("Description"),
|
||||
"LocationUri": self.input.get("LocationUri"),
|
||||
"Parameters": self.input.get("Parameters"),
|
||||
"CreateTime": self.created_time.isoformat(),
|
||||
"CreateTime": unix_time(self.created_time),
|
||||
"CreateTableDefaultPermissions": self.input.get(
|
||||
"CreateTableDefaultPermissions"
|
||||
),
|
||||
@ -797,7 +798,7 @@ class FakeTable(BaseModel):
|
||||
obj = {
|
||||
"DatabaseName": self.database_name,
|
||||
"Name": self.name,
|
||||
"CreateTime": self.created_time.isoformat(),
|
||||
"CreateTime": unix_time(self.created_time),
|
||||
}
|
||||
obj.update(self.get_version(version))
|
||||
return obj
|
||||
|
@ -14,7 +14,7 @@ from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
|
||||
from . import helpers
|
||||
|
||||
|
||||
FROZEN_CREATE_TIME = datetime(2015, 1, 1, 0, 0, 0)
|
||||
FROZEN_CREATE_TIME = datetime(2015, 1, 1, 0, 0, 0, tzinfo=timezone.utc)
|
||||
|
||||
|
||||
@mock_glue
|
||||
@ -34,7 +34,9 @@ def test_create_database():
|
||||
database.get("LocationUri").should.equal(database_input.get("LocationUri"))
|
||||
database.get("Parameters").should.equal(database_input.get("Parameters"))
|
||||
if not settings.TEST_SERVER_MODE:
|
||||
database.get("CreateTime").should.equal(FROZEN_CREATE_TIME)
|
||||
database.get("CreateTime").timestamp().should.equal(
|
||||
FROZEN_CREATE_TIME.timestamp()
|
||||
)
|
||||
database.get("CreateTableDefaultPermissions").should.equal(
|
||||
database_input.get("CreateTableDefaultPermissions")
|
||||
)
|
||||
@ -175,7 +177,7 @@ def test_create_table():
|
||||
table = response["Table"]
|
||||
|
||||
if not settings.TEST_SERVER_MODE:
|
||||
table["CreateTime"].should.equal(FROZEN_CREATE_TIME)
|
||||
table["CreateTime"].timestamp().should.equal(FROZEN_CREATE_TIME.timestamp())
|
||||
|
||||
table["Name"].should.equal(table_input["Name"])
|
||||
table["StorageDescriptor"].should.equal(table_input["StorageDescriptor"])
|
||||
@ -1136,8 +1138,12 @@ def test_create_crawler_scheduled():
|
||||
crawler.get("CrawlElapsedTime").should.equal(0)
|
||||
crawler.get("Version").should.equal(1)
|
||||
if not settings.TEST_SERVER_MODE:
|
||||
crawler.get("CreationTime").should.equal(FROZEN_CREATE_TIME)
|
||||
crawler.get("LastUpdated").should.equal(FROZEN_CREATE_TIME)
|
||||
crawler.get("CreationTime").timestamp().should.equal(
|
||||
FROZEN_CREATE_TIME.timestamp()
|
||||
)
|
||||
crawler.get("LastUpdated").timestamp().should.equal(
|
||||
FROZEN_CREATE_TIME.timestamp()
|
||||
)
|
||||
|
||||
crawler.should.not_have.key("LastCrawl")
|
||||
|
||||
@ -1216,8 +1222,12 @@ def test_create_crawler_unscheduled():
|
||||
crawler.get("CrawlElapsedTime").should.equal(0)
|
||||
crawler.get("Version").should.equal(1)
|
||||
if not settings.TEST_SERVER_MODE:
|
||||
crawler.get("CreationTime").should.equal(FROZEN_CREATE_TIME)
|
||||
crawler.get("LastUpdated").should.equal(FROZEN_CREATE_TIME)
|
||||
crawler.get("CreationTime").timestamp().should.equal(
|
||||
FROZEN_CREATE_TIME.timestamp()
|
||||
)
|
||||
crawler.get("LastUpdated").timestamp().should.equal(
|
||||
FROZEN_CREATE_TIME.timestamp()
|
||||
)
|
||||
|
||||
crawler.should.not_have.key("LastCrawl")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user