Skip to content

Commit

Permalink
Set default value of Info object timestamp (#350)
Browse files Browse the repository at this point in the history
* Set default timestamp to current second

* Remove timestamp from reports
  • Loading branch information
WebSpider authored Feb 12, 2025
1 parent f1b76f7 commit 7eaeea0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions myskoda/rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ async def get_info(self, vin: str, anonymize: bool = False) -> GetEndpointResult
anonymization_fn=anonymize_info,
)
result = self._deserialize(raw, Info.from_json)
result.timestamp = datetime.now(UTC)
url = anonymize_url(url) if anonymize else url
return GetEndpointResult(url=url, raw=raw, result=result)

Expand Down
4 changes: 4 additions & 0 deletions tests/test_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ async def test_report_get(

result = await myskoda.get_endpoint(VIN, report.endpoint, anonymize=True)

# Remove any timestamps
if result.result.timestamp:
result.result.timestamp = None

assert result.result.to_dict() == report.result


Expand Down

0 comments on commit 7eaeea0

Please sign in to comment.