MockWebServer

class lsst.ts.authorize.MockWebServer(token: str)

Bases: object

Mock Web Server for unit tests.

Methods Summary

get_token_handler(request)

POST handler coroutine for get token requests to the mock REST server.

post_request_handler(request)

POST handler coroutine for the mock REST server.

put_request_handler(request)

PUT handler coroutine for the mock REST server.

request_handler(request)

General handler coroutine for the mock REST server.

verify_http_status(request)

Verify that the requester has authenticated itself.

Methods Documentation

async get_token_handler(request: Request) Response

POST handler coroutine for get token requests to the mock REST server.

Parameters
requestweb.Request

The web request to process.

Raises
web_exceptions.HTTPBadRequest

In case the provided credentials are incorrect.

async post_request_handler(request: Request) Response

POST handler coroutine for the mock REST server.

Parameters
requestweb.Request

The web request to process.

async put_request_handler(request: Request) Response

PUT handler coroutine for the mock REST server.

Parameters
requestweb.Request

The web request to process.

async request_handler(request: Request) Response

General handler coroutine for the mock REST server.

Parameters
requestweb.Request

The web request to process.

async verify_http_status(request: Request) None

Verify that the requester has authenticated itself.

Parameters
requestweb.Request

The web request to process.

Raises
web_exceptions.HTTPUnauthorized

In case of missing or invalid credentials.