def __init__(self, test_id, status, message, timestamp=None):
"""
Parametrized constructor for the TestProgress model
:param test_id: The value of the 'test_id' field of TestProgress model
:type test_id: int
:param status: The value of the 'status' field of TestProgress model
:type status: TestStatus
:param message: The value of the 'message' field of TestProgress model
:type message: str
:param timestamp: The value of the 'timestamp' field of TestProgress
model (None by default)
:type timestamp: datetime
"""
self.test_id = test_id
self.status = status
tz = get_localzone()
if timestamp is None:
timestamp = tz.localize(datetime.datetime.now(), is_dst=None)
timestamp = timestamp.astimezone(pytz.UTC)
if timestamp.tzinfo is None:
timestamp = pytz.utc.localize(timestamp, is_dst=None)
self.timestamp = timestamp
self.message = message
评论列表
文章目录