-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: bump werkzeug and Flask #23965
Changes from all commits
7d3f7d1
187aae1
7a76a3e
4e34493
56c28f8
f3ed08e
358b4b4
ee743e1
da866ce
a805236
93db414
cd953b0
eeb0ef2
443473b
493c078
848bd5c
8c7e4a4
b0164a1
832da2c
debbb48
e84b6a7
7e44033
ebfcd83
e928a03
8ec6738
22d579c
5f80dcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ def fetch_events(self, last_id: Optional[str] = None): | |
|
||
@mock.patch("uuid.uuid4", return_value=UUID) | ||
def test_events(self, mock_uuid4): | ||
app._got_first_request = False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a bit of an hack, |
||
async_query_manager.init_app(app) | ||
self.login(username="admin") | ||
with mock.patch.object(async_query_manager._redis, "xrange") as mock_xrange: | ||
|
@@ -46,6 +47,7 @@ def test_events(self, mock_uuid4): | |
|
||
@mock.patch("uuid.uuid4", return_value=UUID) | ||
def test_events_last_id(self, mock_uuid4): | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
self.login(username="admin") | ||
with mock.patch.object(async_query_manager._redis, "xrange") as mock_xrange: | ||
|
@@ -59,6 +61,7 @@ def test_events_last_id(self, mock_uuid4): | |
|
||
@mock.patch("uuid.uuid4", return_value=UUID) | ||
def test_events_results(self, mock_uuid4): | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
self.login(username="admin") | ||
with mock.patch.object(async_query_manager._redis, "xrange") as mock_xrange: | ||
|
@@ -107,6 +110,7 @@ def test_events_results(self, mock_uuid4): | |
self.assertEqual(response, expected) | ||
|
||
def test_events_no_login(self): | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
rv = self.fetch_events() | ||
assert rv.status_code == 401 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,7 @@ | |
from flask import Response | ||
from tests.integration_tests.conftest import with_feature_flags | ||
from superset.models.sql_lab import Query | ||
from tests.integration_tests.base_tests import ( | ||
SupersetTestCase, | ||
test_client, | ||
) | ||
from tests.integration_tests.base_tests import SupersetTestCase, test_client | ||
from tests.integration_tests.annotation_layers.fixtures import create_annotation_layers | ||
from tests.integration_tests.fixtures.birth_names_dashboard import ( | ||
load_birth_names_dashboard_with_slices, | ||
|
@@ -626,6 +623,7 @@ def test_when_where_parameter_is_template_and_query_result_type__query_is_templa | |
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices") | ||
def test_chart_data_async(self): | ||
self.logout() | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
self.login("admin") | ||
rv = self.post_assert_metric(CHART_DATA_URI, self.query_context_payload, "data") | ||
|
@@ -643,6 +641,7 @@ def test_chart_data_async_cached_sync_response(self): | |
Chart data API: Test chart data query returns results synchronously | ||
when results are already cached. | ||
""" | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
|
||
class QueryContext: | ||
|
@@ -672,6 +671,7 @@ def test_chart_data_async_results_type(self): | |
""" | ||
Chart data API: Test chart data query non-JSON format (async) | ||
""" | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
self.query_context_payload["result_type"] = "results" | ||
rv = self.post_assert_metric(CHART_DATA_URI, self.query_context_payload, "data") | ||
|
@@ -683,6 +683,7 @@ def test_chart_data_async_invalid_token(self): | |
""" | ||
Chart data API: Test chart data query (async) | ||
""" | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
test_client.set_cookie( | ||
"localhost", app.config["GLOBAL_ASYNC_QUERIES_JWT_COOKIE_NAME"], "foo" | ||
|
@@ -998,6 +999,7 @@ def test_chart_data_cache(self, cache_loader): | |
""" | ||
Chart data cache API: Test chart data async cache request | ||
""" | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
cache_loader.load.return_value = self.query_context_payload | ||
orig_run = ChartDataCommand.run | ||
|
@@ -1024,6 +1026,7 @@ def test_chart_data_cache_run_failed(self, cache_loader): | |
""" | ||
Chart data cache API: Test chart data async cache request with run failure | ||
""" | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
cache_loader.load.return_value = self.query_context_payload | ||
rv = self.get_assert_metric( | ||
|
@@ -1041,8 +1044,9 @@ def test_chart_data_cache_no_login(self, cache_loader): | |
""" | ||
Chart data cache API: Test chart data async cache request (no login) | ||
""" | ||
self.logout() | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
self.logout() | ||
cache_loader.load.return_value = self.query_context_payload | ||
orig_run = ChartDataCommand.run | ||
|
||
|
@@ -1063,6 +1067,7 @@ def test_chart_data_cache_key_error(self): | |
""" | ||
Chart data cache API: Test chart data async cache request with invalid cache key | ||
""" | ||
app._got_first_request = False | ||
async_query_manager.init_app(app) | ||
rv = self.get_assert_metric( | ||
f"{CHART_DATA_URI}/test-cache-key", "data_from_cache" | ||
|
@@ -1188,10 +1193,10 @@ def test_data_cache_default_timeout( | |
|
||
|
||
def test_chart_cache_timeout( | ||
load_energy_table_with_slice: List[Slice], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting case that surfaced on this new Flask version. Flask now is stricter, so when popping a new context from the app stack it checks if the context is the one we are expecting. |
||
test_client, | ||
login_as_admin, | ||
physical_query_context, | ||
load_energy_table_with_slice: List[Slice], | ||
): | ||
# should override datasource cache timeout | ||
|
||
|
@@ -1210,7 +1215,6 @@ def test_chart_cache_timeout( | |
db.session.commit() | ||
|
||
physical_query_context["form_data"] = {"slice_id": slice_with_cache_timeout.id} | ||
|
||
rv = test_client.post(CHART_DATA_URI, json=physical_query_context) | ||
assert rv.json["result"][0]["cache_timeout"] == 20 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,17 +447,19 @@ def test_validate_parameters_missing(): | |
"query": {}, | ||
} | ||
} | ||
errors = BasicParametersMixin.validate_parameters(properties) | ||
assert errors == [ | ||
SupersetError( | ||
message=( | ||
"One or more parameters are missing: " "database, host, port, username" | ||
with app.app_context(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SupersetError uses flask-babel that needs an app context, Flask is stricter now |
||
errors = BasicParametersMixin.validate_parameters(properties) | ||
assert errors == [ | ||
SupersetError( | ||
message=( | ||
"One or more parameters are missing: " | ||
"database, host, port, username" | ||
), | ||
error_type=SupersetErrorType.CONNECTION_MISSING_PARAMETERS_ERROR, | ||
level=ErrorLevel.WARNING, | ||
extra={"missing": ["database", "host", "port", "username"]}, | ||
), | ||
error_type=SupersetErrorType.CONNECTION_MISSING_PARAMETERS_ERROR, | ||
level=ErrorLevel.WARNING, | ||
extra={"missing": ["database", "host", "port", "username"]}, | ||
), | ||
] | ||
] | ||
|
||
|
||
@mock.patch("superset.db_engine_specs.base.is_hostname_valid") | ||
|
@@ -474,21 +476,22 @@ def test_validate_parameters_invalid_host(is_hostname_valid): | |
"query": {"sslmode": "verify-full"}, | ||
} | ||
} | ||
errors = BasicParametersMixin.validate_parameters(properties) | ||
assert errors == [ | ||
SupersetError( | ||
message="One or more parameters are missing: port", | ||
error_type=SupersetErrorType.CONNECTION_MISSING_PARAMETERS_ERROR, | ||
level=ErrorLevel.WARNING, | ||
extra={"missing": ["port"]}, | ||
), | ||
SupersetError( | ||
message="The hostname provided can't be resolved.", | ||
error_type=SupersetErrorType.CONNECTION_INVALID_HOSTNAME_ERROR, | ||
level=ErrorLevel.ERROR, | ||
extra={"invalid": ["host"]}, | ||
), | ||
] | ||
with app.app_context(): | ||
errors = BasicParametersMixin.validate_parameters(properties) | ||
assert errors == [ | ||
SupersetError( | ||
message="One or more parameters are missing: port", | ||
error_type=SupersetErrorType.CONNECTION_MISSING_PARAMETERS_ERROR, | ||
level=ErrorLevel.WARNING, | ||
extra={"missing": ["port"]}, | ||
), | ||
SupersetError( | ||
message="The hostname provided can't be resolved.", | ||
error_type=SupersetErrorType.CONNECTION_INVALID_HOSTNAME_ERROR, | ||
level=ErrorLevel.ERROR, | ||
extra={"invalid": ["host"]}, | ||
), | ||
] | ||
|
||
|
||
@mock.patch("superset.db_engine_specs.base.is_hostname_valid") | ||
|
@@ -507,20 +510,21 @@ def test_validate_parameters_port_closed(is_port_open, is_hostname_valid): | |
"query": {"sslmode": "verify-full"}, | ||
} | ||
} | ||
errors = BasicParametersMixin.validate_parameters(properties) | ||
assert errors == [ | ||
SupersetError( | ||
message="The port is closed.", | ||
error_type=SupersetErrorType.CONNECTION_PORT_CLOSED_ERROR, | ||
level=ErrorLevel.ERROR, | ||
extra={ | ||
"invalid": ["port"], | ||
"issue_codes": [ | ||
{"code": 1008, "message": "Issue 1008 - The port is closed."} | ||
], | ||
}, | ||
) | ||
] | ||
with app.app_context(): | ||
errors = BasicParametersMixin.validate_parameters(properties) | ||
assert errors == [ | ||
SupersetError( | ||
message="The port is closed.", | ||
error_type=SupersetErrorType.CONNECTION_PORT_CLOSED_ERROR, | ||
level=ErrorLevel.ERROR, | ||
extra={ | ||
"invalid": ["port"], | ||
"issue_codes": [ | ||
{"code": 1008, "message": "Issue 1008 - The port is closed."} | ||
], | ||
}, | ||
) | ||
] | ||
|
||
|
||
def test_get_indexes(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you to pin
werkzeug
in setup.py because we use this lib in superset project directly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, makes sense