Support content attribute for a Testing Response. (#968)

`content` is a documented attribute of a testing response which isn't part
of the parent HttpResponseBase:

https://docs.djangoproject.com/en/4.0/topics/testing/tools/#testing-responses
This commit is contained in:
Ceesjan Luiten
2022-05-26 12:17:22 +02:00
committed by GitHub
parent 0a13d2c653
commit 42d8e18bf8
2 changed files with 4 additions and 0 deletions

View File

@@ -126,6 +126,7 @@ class _MonkeyPatchedWSGIResponse(_WSGIResponse):
client: Client
templates: List[Template]
context: List[Dict[str, Any]]
content: bytes
resolver_match: ResolverMatch
class _MonkeyPatchedASGIResponse(_ASGIResponse):
@@ -134,6 +135,7 @@ class _MonkeyPatchedASGIResponse(_ASGIResponse):
client: AsyncClient
templates: List[Template]
context: List[Dict[str, Any]]
content: bytes
resolver_match: ResolverMatch
class ClientMixin:

View File

@@ -8,6 +8,7 @@
reveal_type(response.templates) # N: Revealed type is "builtins.list[django.template.base.Template]"
reveal_type(response.client) # N: Revealed type is "django.test.client.Client"
reveal_type(response.context) # N: Revealed type is "builtins.list[builtins.dict[builtins.str, Any]]"
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
response.json()
- case: async_client_methods
main: |
@@ -20,6 +21,7 @@
reveal_type(response.templates) # N: Revealed type is "builtins.list[django.template.base.Template]"
reveal_type(response.client) # N: Revealed type is "django.test.client.AsyncClient"
reveal_type(response.context) # N: Revealed type is "builtins.list[builtins.dict[builtins.str, Any]]"
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
response.json()
- case: request_factories
main: |