mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: flaky test for dashboard changed on (#19483)
This commit is contained in:
parent
d954c3df86
commit
a2e921bd03
@ -17,11 +17,9 @@
|
|||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
"""Unit tests for Superset"""
|
"""Unit tests for Superset"""
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from zipfile import is_zipfile, ZipFile
|
from zipfile import is_zipfile, ZipFile
|
||||||
|
|
||||||
import humanize
|
|
||||||
import prison
|
import prison
|
||||||
import pytest
|
import pytest
|
||||||
import yaml
|
import yaml
|
||||||
@ -803,7 +801,6 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
|
|||||||
Dashboard API: Test get charts changed on
|
Dashboard API: Test get charts changed on
|
||||||
"""
|
"""
|
||||||
admin = self.get_user("admin")
|
admin = self.get_user("admin")
|
||||||
start_changed_on = datetime.now()
|
|
||||||
chart = self.insert_chart("foo_a", [admin.id], 1, description="ZY_bar")
|
chart = self.insert_chart("foo_a", [admin.id], 1, description="ZY_bar")
|
||||||
|
|
||||||
self.login(username="admin")
|
self.login(username="admin")
|
||||||
@ -817,9 +814,9 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixin):
|
|||||||
rv = self.get_assert_metric(uri, "get_list")
|
rv = self.get_assert_metric(uri, "get_list")
|
||||||
self.assertEqual(rv.status_code, 200)
|
self.assertEqual(rv.status_code, 200)
|
||||||
data = json.loads(rv.data.decode("utf-8"))
|
data = json.loads(rv.data.decode("utf-8"))
|
||||||
self.assertEqual(
|
assert data["result"][0]["changed_on_delta_humanized"] in (
|
||||||
data["result"][0]["changed_on_delta_humanized"],
|
"now",
|
||||||
humanize.naturaltime(datetime.now() - start_changed_on),
|
"a second ago",
|
||||||
)
|
)
|
||||||
|
|
||||||
# rollback changes
|
# rollback changes
|
||||||
|
Loading…
Reference in New Issue
Block a user