Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
dialogflow test: Fix nonsensical tests.
Steve Howell3de2e4f034bf
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.pyindex b8b3e591b63..40322e7530c 100644--- a/zerver/lib/test_classes.py+++ b/zerver/lib/test_classes.py@@ -1025,14 +1025,13 @@ class WebhookTestCase(ZulipTestCase):def send_and_test_private_message(self,fixture_name: str,- expected_topic: Optional[str] = None,- expected_message: Optional[str] = None,- content_type: Optional[str] = "application/json",+ expected_message: str,+ content_type: str = "application/json",**kwargs: Any,) -> Message:payload = self.get_body(fixture_name)- if content_type is not None:- kwargs['content_type'] = content_type+ kwargs['content_type'] = content_type+if self.FIXTURE_DIR_NAME is not None:headers = get_fixture_http_headers(self.FIXTURE_DIR_NAME, fixture_name)headers = standardize_headers(headers)diff --git a/zerver/webhooks/dialogflow/tests.py b/zerver/webhooks/dialogflow/tests.pyindex 2781a958456..22f6d4c5012 100644--- a/zerver/webhooks/dialogflow/tests.py+++ b/zerver/webhooks/dialogflow/tests.py@@ -5,26 +5,13 @@ class DialogflowHookTests(WebhookTestCase):URL_TEMPLATE = "/api/v1/external/dialogflow?api_key={api_key}&[email protected]"def test_dialogflow_default(self) -> None:- self.url = self.build_webhook_url(- email="[email protected]",- username="aaron",- user_ip="127.0.0.1",- )- expected_message = "Today the weather in Delhi: Sunny, And the tempreture is 65F"- self.send_and_test_private_message('default',- expected_message,- content_type="application/json")-- def test_dialogflow_weather_app(self) -> None:self.url = self.build_webhook_url(email="[email protected]",username="aaron",user_ip="127.0.0.1",)expected_message = "The weather sure looks great !"- self.send_and_test_private_message('weather_app',- expected_message,- content_type="application/json")+ self.send_and_test_private_message("default", expected_message)def test_dialogflow_alternate_result(self) -> None:self.url = self.build_webhook_url(@@ -33,9 +20,7 @@ class DialogflowHookTests(WebhookTestCase):user_ip="127.0.0.1",)expected_message = "Weather in New Delhi is nice!"- self.send_and_test_private_message('alternate_result',- expected_message,- content_type="application/json")+ self.send_and_test_private_message("alternate_result", expected_message)def test_dialogflow_error_status(self) -> None:self.url = self.build_webhook_url(@@ -44,9 +29,7 @@ class DialogflowHookTests(WebhookTestCase):user_ip="127.0.0.1",)expected_message = "403 - Access Denied"- self.send_and_test_private_message('error_status',- expected_message,- content_type="application/json")+ self.send_and_test_private_message("error_status", expected_message)def test_dialogflow_exception(self) -> None:self.url = self.build_webhook_url(@@ -55,9 +38,7 @@ class DialogflowHookTests(WebhookTestCase):user_ip="127.0.0.1",)expected_message = "DialogFlow couldn't process your query."- self.send_and_test_private_message('exception',- expected_message,- content_type="application/json")+ self.send_and_test_private_message("exception", expected_message)def get_body(self, fixture_name: str) -> str:return self.webhook_fixture_data("dialogflow",