Skip to content

Commit

Permalink
Fix failing Black test on connexion (#10547)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxil authored Aug 25, 2020
1 parent 7c0d6ab commit 4c6b759
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions tests/api_connexion/endpoints/test_dag_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def test_should_response_200_with_update_mask(self):
response = self.client.patch(
f"/api/v1/dags/{dag_model.dag_id}?update_mask=is_paused",
json=payload,
environ_overrides={'REMOTE_USER': "test"}
environ_overrides={'REMOTE_USER': "test"},
)
self.assertEqual(response.status_code, 200)
expected_response = {
Expand All @@ -370,39 +370,32 @@ def test_should_response_200_with_update_mask(self):
"is_subdag": False,
"owners": [],
"root_dag_id": None,
"schedule_interval": {
"__type": "CronExpression",
"value": "2 2 * * *",
},
"schedule_interval": {"__type": "CronExpression", "value": "2 2 * * *",},
"tags": [],
}
self.assertEqual(response.json, expected_response)

@parameterized.expand([
(
{
"is_paused": True,
},
"update_mask=description",
"Only `is_paused` field can be updated through the REST API"
),
(
{
"is_paused": True,
},
"update_mask=schedule_interval, description",
"Only `is_paused` field can be updated through the REST API"
)
])
def test_should_response_400_for_invalid_fields_in_update_mask(
self, payload, update_mask, error_message
):
@parameterized.expand(
[
(
{"is_paused": True,},
"update_mask=description",
"Only `is_paused` field can be updated through the REST API",
),
(
{"is_paused": True,},
"update_mask=schedule_interval, description",
"Only `is_paused` field can be updated through the REST API",
),
]
)
def test_should_response_400_for_invalid_fields_in_update_mask(self, payload, update_mask, error_message):
dag_model = self._create_dag_model()

response = self.client.patch(
f"/api/v1/dags/{dag_model.dag_id}?{update_mask}",
json=payload,
environ_overrides={'REMOTE_USER': "test"}
environ_overrides={'REMOTE_USER': "test"},
)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json['detail'], error_message)

0 comments on commit 4c6b759

Please sign in to comment.