mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
refactor(plugins): BigNumber Time Comparison with existing time_offset API (#27718)
Co-authored-by: lilykuang <jialikuang@gmail.com> Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com>
This commit is contained in:
@@ -1520,6 +1520,20 @@ class TestChartApi(ApiOwnersTestCaseMixin, InsertChartMixin, SupersetTestCase):
|
||||
assert "until" in data["result"][0]
|
||||
assert "timeRange" in data["result"][0]
|
||||
|
||||
humanize_time_range = [
|
||||
{"timeRange": "2021-01-01 : 2022-02-01", "shift": "1 year ago"},
|
||||
{"timeRange": "2022-01-01 : 2023-02-01", "shift": "2 year ago"},
|
||||
]
|
||||
uri = f"api/v1/time_range/?q={prison.dumps(humanize_time_range)}"
|
||||
rv = self.client.get(uri)
|
||||
data = json.loads(rv.data.decode("utf-8"))
|
||||
assert rv.status_code == 200
|
||||
assert len(data["result"]) == 2
|
||||
assert "since" in data["result"][0]
|
||||
assert "until" in data["result"][0]
|
||||
assert "timeRange" in data["result"][0]
|
||||
assert "shift" in data["result"][0]
|
||||
|
||||
def test_query_form_data(self):
|
||||
"""
|
||||
Chart API: Test query form data
|
||||
|
||||
Reference in New Issue
Block a user