mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-13 15:31:55 +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
|
client: Client
|
||||||
templates: List[Template]
|
templates: List[Template]
|
||||||
context: List[Dict[str, Any]]
|
context: List[Dict[str, Any]]
|
||||||
|
content: bytes
|
||||||
resolver_match: ResolverMatch
|
resolver_match: ResolverMatch
|
||||||
|
|
||||||
class _MonkeyPatchedASGIResponse(_ASGIResponse):
|
class _MonkeyPatchedASGIResponse(_ASGIResponse):
|
||||||
@@ -134,6 +135,7 @@ class _MonkeyPatchedASGIResponse(_ASGIResponse):
|
|||||||
client: AsyncClient
|
client: AsyncClient
|
||||||
templates: List[Template]
|
templates: List[Template]
|
||||||
context: List[Dict[str, Any]]
|
context: List[Dict[str, Any]]
|
||||||
|
content: bytes
|
||||||
resolver_match: ResolverMatch
|
resolver_match: ResolverMatch
|
||||||
|
|
||||||
class ClientMixin:
|
class ClientMixin:
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
reveal_type(response.templates) # N: Revealed type is "builtins.list[django.template.base.Template]"
|
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.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.context) # N: Revealed type is "builtins.list[builtins.dict[builtins.str, Any]]"
|
||||||
|
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
|
||||||
response.json()
|
response.json()
|
||||||
- case: async_client_methods
|
- case: async_client_methods
|
||||||
main: |
|
main: |
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
reveal_type(response.templates) # N: Revealed type is "builtins.list[django.template.base.Template]"
|
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.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.context) # N: Revealed type is "builtins.list[builtins.dict[builtins.str, Any]]"
|
||||||
|
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
|
||||||
response.json()
|
response.json()
|
||||||
- case: request_factories
|
- case: request_factories
|
||||||
main: |
|
main: |
|
||||||
|
|||||||
Reference in New Issue
Block a user