chore: upgrade black (#19410)

This commit is contained in:
Ville Brofeldt
2022-03-29 20:03:09 +03:00
committed by GitHub
parent 816a2c3e1e
commit a619cb4ea9
204 changed files with 2125 additions and 608 deletions

View File

@@ -329,7 +329,11 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
"changed_by_name": "",
"changed_by_url": "",
"charts": [],
"created_by": {"id": 1, "first_name": "admin", "last_name": "user",},
"created_by": {
"id": 1,
"first_name": "admin",
"last_name": "user",
},
"id": dashboard.id,
"css": "",
"dashboard_title": "title",
@@ -356,7 +360,10 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
self.assertIn("changed_on_delta_humanized", data["result"])
for key, value in data["result"].items():
# We can't assert timestamp values
if key not in ("changed_on", "changed_on_delta_humanized",):
if key not in (
"changed_on",
"changed_on_delta_humanized",
):
self.assertEqual(value, expected_result[key])
# rollback changes
db.session.delete(dashboard)
@@ -623,7 +630,13 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
@pytest.mark.usefixtures("create_dashboards")
def test_gets_certified_dashboards_filter(self):
arguments = {
"filters": [{"col": "id", "opr": "dashboard_is_certified", "value": True,}],
"filters": [
{
"col": "id",
"opr": "dashboard_is_certified",
"value": True,
}
],
"keys": ["none"],
"columns": ["dashboard_title"],
}
@@ -639,7 +652,11 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
def test_gets_not_certified_dashboards_filter(self):
arguments = {
"filters": [
{"col": "id", "opr": "dashboard_is_certified", "value": False,}
{
"col": "id",
"opr": "dashboard_is_certified",
"value": False,
}
],
"keys": ["none"],
"columns": ["dashboard_title"],
@@ -1135,7 +1152,12 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
slices.append(db.session.query(Slice).filter_by(slice_name="Trends").first())
slices.append(db.session.query(Slice).filter_by(slice_name="Boys").first())
dashboard = self.insert_dashboard("title1", "slug1", [admin.id], slices=slices,)
dashboard = self.insert_dashboard(
"title1",
"slug1",
[admin.id],
slices=slices,
)
self.login(username="admin")
uri = f"api/v1/dashboard/{dashboard.id}"
dashboard_data = {"owners": [user_alpha1.id, user_alpha2.id]}

View File

@@ -37,7 +37,9 @@ if TYPE_CHECKING:
class TestGetFilterSetsApi:
def test_with_dashboard_not_exists__404(
self, not_exists_dashboard_id: int, client: FlaskClient[Any],
self,
not_exists_dashboard_id: int,
client: FlaskClient[Any],
):
# arrange
login(client, "admin")

View File

@@ -61,7 +61,8 @@ def permalink_salt() -> Iterator[str]:
yield salt
namespace = get_uuid_namespace(salt)
db.session.query(KeyValueEntry).filter_by(
resource=KeyValueResource.APP, uuid=uuid3(namespace, key),
resource=KeyValueResource.APP,
uuid=uuid3(namespace, key),
)
db.session.commit()

View File

@@ -91,11 +91,14 @@ class TestDashboardDatasetSecurity(DashboardTestCase):
username = "gamma"
user = security_manager.find_user(username)
my_owned_dashboard = create_dashboard_to_db(
dashboard_title="My Dashboard", published=False, owners=[user],
dashboard_title="My Dashboard",
published=False,
owners=[user],
)
not_my_owned_dashboard = create_dashboard_to_db(
dashboard_title="Not My Dashboard", published=False,
dashboard_title="Not My Dashboard",
published=False,
)
self.login(user.username)

View File

@@ -41,7 +41,8 @@ CHART_DATA_URI = "api/v1/chart/data"
@mock.patch.dict(
"superset.extensions.feature_flag_manager._feature_flags", DASHBOARD_RBAC=True,
"superset.extensions.feature_flag_manager._feature_flags",
DASHBOARD_RBAC=True,
)
class TestDashboardRoleBasedSecurity(BaseTestDashboardSecurity):
def test_get_dashboard_view__admin_can_access(self):
@@ -293,7 +294,10 @@ class TestDashboardRoleBasedSecurity(BaseTestDashboardSecurity):
# assert
self.assert_dashboards_api_response(
response, len(published_dashboards), published_dashboards, draft_dashboards,
response,
len(published_dashboards),
published_dashboards,
draft_dashboards,
)
# post
@@ -337,7 +341,10 @@ class TestDashboardRoleBasedSecurity(BaseTestDashboardSecurity):
# assert
self.assert_dashboards_api_response(
response, len(published_dashboards), published_dashboards, draft_dashboards,
response,
len(published_dashboards),
published_dashboards,
draft_dashboards,
)
# post