coarnotify.test.server.inbox

Single file implementation of a test server, showing all the layers of the general solution in one place.

Attributes

app

The global flask app for the test server

Classes

COARNotifyServiceTestImpl

Test server implementation of the main service binding

Functions

create_app()

Create the flask app, pulling config from settings.py then any supplied local config

inbox()

Main web entry point. POST to /inbox to trigger it

run_server([host, port, fake_https])

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:

  1. Generate a name for the notification based on the timestamp and a random UUID

  2. Write the notification JSON-LD to a file in the store directory

  3. 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 variable COARNOTIFY_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