coarnotify.test.server.inbox¶
Single file implementation of a test server, showing all the layers of the general solution in one place.
Attributes¶
The global flask app for the test server |
Classes¶
Test server implementation of the main service binding |
Functions¶
Create the flask app, pulling config from |
|
|
Main web entry point. POST to /inbox to trigger it |
|
Start the web server using the flask built in server |
Module Contents¶
- class coarnotify.test.server.inbox.COARNotifyServiceTestImpl¶
Bases:
coarnotify.server.COARNotifyServiceBinding
Test server implementation of the main service binding
- notification_received(notification: coarnotify.core.notify.NotifyPattern) coarnotify.server.COARNotifyReceipt ¶
Process an incoming notification object in the following way:
Generate a name for the notification based on the timestamp and a random UUID
Write the notification JSON-LD to a file in the store directory
Return a receipt for the notification using the configured response status and a location pointing to the file
- Parameters:
notification
- Returns:
- coarnotify.test.server.inbox.create_app()¶
Create the flask app, pulling config from
settings.py
then any supplied local config in environment variableCOARNOTIFY_SETTINGS
.- Returns:
- coarnotify.test.server.inbox.inbox()¶
Main web entry point. POST to /inbox to trigger it
This pulls the notification out of the request as JSON, and sends it to the server which will parse it and send it on to the service binding implementation
When it gets the receipt it will return a blank HTTP response with the appropriate status code and Location header
- Returns:
- coarnotify.test.server.inbox.run_server(host=None, port=None, fake_https=False)¶
Start the web server using the flask built in server
- Parameters:
host
port
fake_https – if fake_https is True, developer can use https:// to access the server
- Returns:
- coarnotify.test.server.inbox.app¶
The global flask app for the test server