mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(api): bump marshmallow and FAB to version 3 (#9964)
* feat(api): bump marshmallow and FAB to version 3 * revert query context tests changes * obey mypy * fix tests * ignore types that collide with marshmallow * preparing for RC2 * fix tests for marshmallow 3 * typing fixes for marshmallow * fix tests and black * fix tests * bump to RC3 and lint * Test RC4 * Final 3.0.0 * Address comments, fix tests, better naming, docs * fix test * couple of fixes, addressing comments * bumping marshmallow
This commit is contained in:
committed by
GitHub
parent
bacf567656
commit
878dbcda3f
@@ -338,7 +338,8 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin):
|
||||
self.assertEqual(rv.status_code, 400)
|
||||
response = json.loads(rv.data.decode("utf-8"))
|
||||
self.assertEqual(
|
||||
response, {"message": {"datasource_type": ["Not a valid choice."]}}
|
||||
response,
|
||||
{"message": {"datasource_type": ["Must be one of: druid, table, view."]}},
|
||||
)
|
||||
chart_data = {
|
||||
"slice_name": "title1",
|
||||
@@ -444,7 +445,8 @@ class TestChartApi(SupersetTestCase, ApiOwnersTestCaseMixin):
|
||||
self.assertEqual(rv.status_code, 400)
|
||||
response = json.loads(rv.data.decode("utf-8"))
|
||||
self.assertEqual(
|
||||
response, {"message": {"datasource_type": ["Not a valid choice."]}}
|
||||
response,
|
||||
{"message": {"datasource_type": ["Must be one of: druid, table, view."]}},
|
||||
)
|
||||
chart_data = {"datasource_id": 0, "datasource_type": "table"}
|
||||
uri = f"api/v1/chart/{chart.id}"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"""Unit tests for Superset"""
|
||||
from typing import Any, Dict, Tuple
|
||||
|
||||
from marshmallow import ValidationError
|
||||
from tests.test_app import app
|
||||
from superset.charts.schemas import ChartDataQueryContextSchema
|
||||
from superset.common.query_context import QueryContext
|
||||
@@ -39,8 +40,7 @@ class TestSchema(SupersetTestCase):
|
||||
# Use defaults
|
||||
payload["queries"][0].pop("row_limit", None)
|
||||
payload["queries"][0].pop("row_offset", None)
|
||||
query_context, errors = load_query_context(payload)
|
||||
self.assertEqual(errors, {})
|
||||
query_context = load_query_context(payload)
|
||||
query_object = query_context.queries[0]
|
||||
self.assertEqual(query_object.row_limit, app.config["ROW_LIMIT"])
|
||||
self.assertEqual(query_object.row_offset, 0)
|
||||
@@ -48,8 +48,7 @@ class TestSchema(SupersetTestCase):
|
||||
# Valid limit and offset
|
||||
payload["queries"][0]["row_limit"] = 100
|
||||
payload["queries"][0]["row_offset"] = 200
|
||||
query_context, errors = ChartDataQueryContextSchema().load(payload)
|
||||
self.assertEqual(errors, {})
|
||||
query_context = ChartDataQueryContextSchema().load(payload)
|
||||
query_object = query_context.queries[0]
|
||||
self.assertEqual(query_object.row_limit, 100)
|
||||
self.assertEqual(query_object.row_offset, 200)
|
||||
@@ -57,9 +56,10 @@ class TestSchema(SupersetTestCase):
|
||||
# too low limit and offset
|
||||
payload["queries"][0]["row_limit"] = 0
|
||||
payload["queries"][0]["row_offset"] = -1
|
||||
query_context, errors = ChartDataQueryContextSchema().load(payload)
|
||||
self.assertIn("row_limit", errors["queries"][0])
|
||||
self.assertIn("row_offset", errors["queries"][0])
|
||||
with self.assertRaises(ValidationError) as context:
|
||||
_ = ChartDataQueryContextSchema().load(payload)
|
||||
self.assertIn("row_limit", context.exception.messages["queries"][0])
|
||||
self.assertIn("row_offset", context.exception.messages["queries"][0])
|
||||
|
||||
def test_query_context_null_timegrain(self):
|
||||
self.login(username="admin")
|
||||
@@ -68,5 +68,4 @@ class TestSchema(SupersetTestCase):
|
||||
payload = get_query_context(table.name, table.id, table.type)
|
||||
|
||||
payload["queries"][0]["extras"]["time_grain_sqla"] = None
|
||||
_, errors = ChartDataQueryContextSchema().load(payload)
|
||||
self.assertEqual(errors, {})
|
||||
_ = ChartDataQueryContextSchema().load(payload)
|
||||
|
||||
Reference in New Issue
Block a user