mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-11 06:21:58 +08:00
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:
@@ -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:
|
||||
|
||||
@@ -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: |
|
||||
|
||||
Reference in New Issue
Block a user