bito-code-review[bot] commented on PR #44358: URL: https://github.com/apache/superset/pull/44358#issuecomment-5884987112
<!-- Bito Reply --> The suggestion to verify that `changed_on` advances is a valid improvement for the regression tests. Currently, the tests only assert that the field is not `None`, which does not guarantee that the timestamp was updated to the current time. To implement this, you can seed the dashboard with a past timestamp and assert that `changed_on` is greater than that initial value after the command runs. For example: ```python # Seed with a past time initial_time = datetime(2020, 1, 1) dashboard = MagicMock(id=1, changed_on=initial_time, changed_by=None) # ... run command ... # Assert it advanced assert dashboard.changed_on > initial_time ``` This ensures the logic is actually updating the field to the current time rather than just setting it to a non-null value. **tests/unit_tests/commands/chart/create_test.py** ``` initial_time = datetime(2020, 1, 1) dashboard = MagicMock(id=1, changed_on=initial_time, changed_by=None) # ... run command ... assert dashboard.changed_on > initial_time ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
