Skip to content

Commit

Permalink
Add test client response.redirect_chain (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Aug 26, 2022
1 parent 8b5509b commit 1a310ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions django-stubs/test/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class _MonkeyPatchedWSGIResponse(_WSGIResponse):
context: ContextList | Dict[str, Any]
content: bytes
resolver_match: ResolverMatch
redirect_chain: List[Tuple[str, int]]

class _MonkeyPatchedASGIResponse(_ASGIResponse):
def json(self) -> Any: ...
Expand All @@ -138,6 +139,7 @@ class _MonkeyPatchedASGIResponse(_ASGIResponse):
context: ContextList | Dict[str, Any]
content: bytes
resolver_match: ResolverMatch
redirect_chain: List[Tuple[str, int]]

class ClientMixin:
def store_exc_info(self, **kwargs: Any) -> None: ...
Expand Down
2 changes: 2 additions & 0 deletions tests/typecheck/test/test_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
reveal_type(response.client) # N: Revealed type is "django.test.client.Client"
reveal_type(response.context) # N: Revealed type is "Union[django.test.utils.ContextList, builtins.dict[builtins.str, Any]]"
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
reveal_type(response.redirect_chain) # N: Revealed type is "builtins.list[Tuple[builtins.str, builtins.int]]"
response.json()
- case: async_client_methods
main: |
Expand All @@ -22,6 +23,7 @@
reveal_type(response.client) # N: Revealed type is "django.test.client.AsyncClient"
reveal_type(response.context) # N: Revealed type is "Union[django.test.utils.ContextList, builtins.dict[builtins.str, Any]]"
reveal_type(response.content) # N: Revealed type is "builtins.bytes"
reveal_type(response.redirect_chain) # N: Revealed type is "builtins.list[Tuple[builtins.str, builtins.int]]"
response.json()
- case: request_factories
main: |
Expand Down

0 comments on commit 1a310ef

Please sign in to comment.