Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestClient methods return Result, not _ResultBase #2209

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions falcon/testing/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def simulate_request(
cookies=None,
asgi_chunk_size=4096,
asgi_disconnect_ttl=300,
) -> _ResultBase:
) -> Result:

"""Simulate a request to a WSGI or ASGI application.

Expand Down Expand Up @@ -1038,7 +1038,7 @@ async def __aexit__(self, ex_type, ex, tb):

return True

async def simulate_get(self, path='/', **kwargs) -> _ResultBase:
async def simulate_get(self, path='/', **kwargs) -> Result:
"""Simulate a GET request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_get`)
Expand Down Expand Up @@ -1107,49 +1107,49 @@ def simulate_ws(self, path='/', **kwargs):

return _WSContextManager(ws, task_req)

async def simulate_head(self, path='/', **kwargs) -> _ResultBase:
async def simulate_head(self, path='/', **kwargs) -> Result:
"""Simulate a HEAD request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_head`)
"""
return await self.simulate_request('HEAD', path, **kwargs)

async def simulate_post(self, path='/', **kwargs) -> _ResultBase:
async def simulate_post(self, path='/', **kwargs) -> Result:
"""Simulate a POST request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_post`)
"""
return await self.simulate_request('POST', path, **kwargs)

async def simulate_put(self, path='/', **kwargs) -> _ResultBase:
async def simulate_put(self, path='/', **kwargs) -> Result:
"""Simulate a PUT request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_put`)
"""
return await self.simulate_request('PUT', path, **kwargs)

async def simulate_options(self, path='/', **kwargs) -> _ResultBase:
async def simulate_options(self, path='/', **kwargs) -> Result:
"""Simulate an OPTIONS request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_options`)
"""
return await self.simulate_request('OPTIONS', path, **kwargs)

async def simulate_patch(self, path='/', **kwargs) -> _ResultBase:
async def simulate_patch(self, path='/', **kwargs) -> Result:
"""Simulate a PATCH request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_patch`)
"""
return await self.simulate_request('PATCH', path, **kwargs)

async def simulate_delete(self, path='/', **kwargs) -> _ResultBase:
async def simulate_delete(self, path='/', **kwargs) -> Result:
"""Simulate a DELETE request to an ASGI application.

(See also: :py:meth:`falcon.testing.simulate_delete`)
"""
return await self.simulate_request('DELETE', path, **kwargs)

async def simulate_request(self, *args, **kwargs) -> _ResultBase:
async def simulate_request(self, *args, **kwargs) -> Result:
"""Simulate a request to an ASGI application.

Wraps :py:meth:`falcon.testing.simulate_request` to perform a
Expand Down Expand Up @@ -1185,7 +1185,7 @@ async def simulate_request(self, *args, **kwargs) -> _ResultBase:
websocket = _simulate_method_alias(simulate_ws, replace_name='websocket')


def simulate_get(app, path, **kwargs) -> _ResultBase:
def simulate_get(app, path, **kwargs) -> Result:
"""Simulate a GET request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -1288,7 +1288,7 @@ def simulate_get(app, path, **kwargs) -> _ResultBase:
return simulate_request(app, 'GET', path, **kwargs)


def simulate_head(app, path, **kwargs) -> _ResultBase:
def simulate_head(app, path, **kwargs) -> Result:
"""Simulate a HEAD request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -1385,7 +1385,7 @@ def simulate_head(app, path, **kwargs) -> _ResultBase:
return simulate_request(app, 'HEAD', path, **kwargs)


def simulate_post(app, path, **kwargs) -> _ResultBase:
def simulate_post(app, path, **kwargs) -> Result:
"""Simulate a POST request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -1496,7 +1496,7 @@ def simulate_post(app, path, **kwargs) -> _ResultBase:
return simulate_request(app, 'POST', path, **kwargs)


def simulate_put(app, path, **kwargs) -> _ResultBase:
def simulate_put(app, path, **kwargs) -> Result:
"""Simulate a PUT request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -1607,7 +1607,7 @@ def simulate_put(app, path, **kwargs) -> _ResultBase:
return simulate_request(app, 'PUT', path, **kwargs)


def simulate_options(app, path, **kwargs) -> _ResultBase:
def simulate_options(app, path, **kwargs) -> Result:
"""Simulate an OPTIONS request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -1696,7 +1696,7 @@ def simulate_options(app, path, **kwargs) -> _ResultBase:
return simulate_request(app, 'OPTIONS', path, **kwargs)


def simulate_patch(app, path, **kwargs) -> _ResultBase:
def simulate_patch(app, path, **kwargs) -> Result:
"""Simulate a PATCH request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -1802,7 +1802,7 @@ def simulate_patch(app, path, **kwargs) -> _ResultBase:
return simulate_request(app, 'PATCH', path, **kwargs)


def simulate_delete(app, path, **kwargs) -> _ResultBase:
def simulate_delete(app, path, **kwargs) -> Result:
"""Simulate a DELETE request to a WSGI or ASGI application.

Equivalent to::
Expand Down Expand Up @@ -2002,56 +2002,56 @@ async def __aexit__(self, ex_type, ex, tb):

return result

def simulate_get(self, path='/', **kwargs) -> _ResultBase:
def simulate_get(self, path='/', **kwargs) -> Result:
"""Simulate a GET request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_get`)
"""
return self.simulate_request('GET', path, **kwargs)

def simulate_head(self, path='/', **kwargs) -> _ResultBase:
def simulate_head(self, path='/', **kwargs) -> Result:
"""Simulate a HEAD request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_head`)
"""
return self.simulate_request('HEAD', path, **kwargs)

def simulate_post(self, path='/', **kwargs) -> _ResultBase:
def simulate_post(self, path='/', **kwargs) -> Result:
"""Simulate a POST request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_post`)
"""
return self.simulate_request('POST', path, **kwargs)

def simulate_put(self, path='/', **kwargs) -> _ResultBase:
def simulate_put(self, path='/', **kwargs) -> Result:
"""Simulate a PUT request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_put`)
"""
return self.simulate_request('PUT', path, **kwargs)

def simulate_options(self, path='/', **kwargs) -> _ResultBase:
def simulate_options(self, path='/', **kwargs) -> Result:
"""Simulate an OPTIONS request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_options`)
"""
return self.simulate_request('OPTIONS', path, **kwargs)

def simulate_patch(self, path='/', **kwargs) -> _ResultBase:
def simulate_patch(self, path='/', **kwargs) -> Result:
"""Simulate a PATCH request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_patch`)
"""
return self.simulate_request('PATCH', path, **kwargs)

def simulate_delete(self, path='/', **kwargs) -> _ResultBase:
def simulate_delete(self, path='/', **kwargs) -> Result:
"""Simulate a DELETE request to a WSGI application.

(See also: :py:meth:`falcon.testing.simulate_delete`)
"""
return self.simulate_request('DELETE', path, **kwargs)

def simulate_request(self, *args, **kwargs) -> _ResultBase:
def simulate_request(self, *args, **kwargs) -> Result:
"""Simulate a request to a WSGI application.

Wraps :py:meth:`falcon.testing.simulate_request` to perform a
Expand Down
Loading