coarnotify.test.server.inbox ============================ .. py:module:: coarnotify.test.server.inbox .. autoapi-nested-parse:: Single file implementation of a test server, showing all the layers of the general solution in one place. Attributes ---------- .. autoapisummary:: coarnotify.test.server.inbox.app Classes ------- .. autoapisummary:: coarnotify.test.server.inbox.COARNotifyServiceTestImpl Functions --------- .. autoapisummary:: coarnotify.test.server.inbox.create_app coarnotify.test.server.inbox.inbox coarnotify.test.server.inbox.run_server Module Contents --------------- .. py:class:: COARNotifyServiceTestImpl Bases: :py:obj:`coarnotify.server.COARNotifyServiceBinding` Test server implementation of the main service binding .. py:method:: 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 :param notification: :return: .. py:function:: create_app() Create the flask app, pulling config from ``settings.py`` then any supplied local config in environment variable ``COARNOTIFY_SETTINGS``. :return: .. py:function:: 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 :return: .. py:function:: run_server(host=None, port=None, fake_https=False) Start the web server using the flask built in server :param host: :param port: :param fake_https: if fake_https is True, developer can use https:// to access the server :return: .. py:data:: app The global flask app for the test server