diff --git a/tests/integration_tests/log_api_tests.py b/tests/integration_tests/log_api_tests.py index bac9d6eadb8bf..83a7f5fd84b31 100644 --- a/tests/integration_tests/log_api_tests.py +++ b/tests/integration_tests/log_api_tests.py @@ -16,8 +16,8 @@ # under the License. # isort:skip_file """Unit tests for Superset""" +from datetime import datetime, timedelta import json -import time from typing import Optional from unittest.mock import ANY @@ -266,11 +266,14 @@ def test_get_recent_activity_pagination(self): dash2 = create_dashboard("dash2_slug", "dash2_title", "{}", []) dash3 = create_dashboard("dash3_slug", "dash3_title", "{}", []) log = self.insert_log("dashboard", admin_user, dashboard_id=dash.id) - time.sleep(0.05) log2 = self.insert_log("dashboard", admin_user, dashboard_id=dash2.id) - time.sleep(0.05) log3 = self.insert_log("dashboard", admin_user, dashboard_id=dash3.id) + now = datetime.now() + log3.dttm = now + log2.dttm = now - timedelta(days=1) + log.dttm = now - timedelta(days=2) + arguments = {"page": 0, "page_size": 2} uri = f"api/v1/log/recent_activity/{admin_user.id}/?q={prison.dumps(arguments)}" rv = self.client.get(uri)