Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

docs: Update doc on how to mock HTTP responses.

akshatdalton803e199063f1
diff --git a/docs/testing/testing-with-django.md b/docs/testing/testing-with-django.md
index 8395dc7ecd7..03e0e40b471 100644
--- a/docs/testing/testing-with-django.md
+++ b/docs/testing/testing-with-django.md
@@ -301,9 +301,15 @@ from Django as well as our own custom helpers. Here is an example:
Follow [this link](../subsystems/settings.html#testing-non-default-settings) for more
information on the "settings" context manager.
-A common use is to prevent a call to a third-party service from using
-the Internet; `git grep mock.patch | grep requests` is a good way to
-find several examples of doing this.
+Zulip has several features, like outgoing webhooks or social
+authentication, that made outgoing HTTP requests to external
+servers. We test those features using the excellent
+[responses](https://pypi.org/project/responses/) library, which has a
+nice interface for mocking `requests` calls to return whatever HTTP
+response from the exteranl server we need for the test. you can find
+examples with `git grep responses.add`. Zulip's own `HostRequestMock`
+class should be used only for low-level tests for code that expects to
+receive Django HttpRequest object.
## Zulip testing philosophy