Skip to content

Commit

Permalink
Set dttm of logs manually
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrag1 committed Jan 24, 2023
1 parent f0aeb3f commit 2d7faa4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/integration_tests/log_api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2d7faa4

Please sign in to comment.