{ "info": { "author": "Grid Smarter Cities", "author_email": "open-source@gridsmartercities.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "[\"Grid](https://www.gridsmartercities.com/)\n\n![Build Status](https://codebuild.eu-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiSitwRmNUcHk2VzN2VS8rMHdUS2hoNzZCQUdCME1VV0RkeWEwTmZyVUxOWUdXR2hMTzVUVWIvLzJ5ZFR2SWo5OHhtSm55TFc4SjZvcGhNcndNT1lDbEdRPSIsIml2UGFyYW1ldGVyU3BlYyI6Ik9SV0g1Tm1FMUVERW9RSzciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n[![PyPI](https://img.shields.io/pypi/v/pywsitest.svg?color=brightgreen)](https://pypi.org/project/pywsitest)\n\n# pywsitest\n## PYthon WebSocket Integration TESTing framework\n\nA python API to assist with automated websocket integration testing\n\n## Installation\n```\npip install pywsitest\n```\n\n## Package contents\n### [WSTest](https://github.com/gridsmartercities/pywsitest/blob/master/pywsitest/ws_test.py)\nWSTest is the main test running class in pywsitest. It currently has the following methods:\n- **with_parameter**: add a query parameter to the connection\n- **with_response**: add an expected response to the test runner\n- **with_message**: add a message for the test runner to send on connection\n- **with_response_timeout**: set the timeout in seconds for the test runner to wait for a response from the websocket\n- **with_message_timeout**: set the timeout in seconds for the test runner to wait while trying to send a message to the websocket\n- **with_test_timeout**: set the timeout in seconds for the test runner to run for\n- **run**: asyncronously run the test runner, sending all messages and listening for responses\n- **is_complete**: check whether all expected responses have been received and messages have been sent\n\n### [WSResponse](https://github.com/gridsmartercities/pywsitest/blob/master/pywsitest/ws_response.py)\nWSResponse is a class to represent an expected response from the websocket\n- **with_attribute**: add an attribute to check an incoming response against\n- **with_trigger**: add a message to trigger when a response matching this instance has been received\n- **is_match**: check whether a received response matches the attributes of this instance\n\n### [WSMessage](https://github.com/gridsmartercities/pywsitest/blob/master/pywsitest/ws_message.py)\nWSMessage is a class to represent a message to send to the websocket\n- **with_attribute**: add an attribute to the message to be sent to the websocket host\n- **with_delay**: add a delay to the message to be sent to the websocket host\n\n## Examples\nTesting a reponse with a body is received on connection to a websocket host:\n```py\nfrom pywsitest import WSTest, WSResponse\n\nws_test = (\n WSTest(\"wss://example.com\")\n .with_response(\n WSResponse()\n .with_attribute(\"body\")\n )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\nSending a message on connection to a websocket host:\n```py\nfrom pywsitest import WSTest, WSMessage\n\nws_test = (\n WSTest(\"wss://example.com\")\n .with_message(\n WSMessage()\n .with_attribute(\"body\", \"Hello, world!\")\n )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\nTriggering a message to be sent when the following response is received:\n```json\n{\n \"body\": {\n \"message\": \"Hello, world!\"\n }\n}\n```\n\n```py\nfrom pywsitest import WSTest, WSResponse, WSMessage\n\nws_test = (\n WSTest(\"wss://example.com\")\n .with_response(\n WSResponse()\n .with_attribute(\"body\")\n .with_trigger(\n WSMessage()\n .with_attribute(\"body\", \"${body/message}\")\n )\n )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\n## Documentation\nUsers can get the docstring help by running:\n```py\nfrom pywsitest import WSTest\nhelp(WSTest.with_response)\n```\n\n## Links\n- [Github](https://github.com/gridsmartercities/pywsitest)\n- [PyPI](https://pypi.org/project/pywsitest)\n- [Test PyPI](https://test.pypi.org/project/pywsitest)\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gridsmartercities/pywsitest", "keywords": "websocket integration test testing", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pywsitest", "package_url": "https://pypi.org/project/pywsitest/", "platform": "", "project_url": "https://pypi.org/project/pywsitest/", "project_urls": { "Homepage": "https://github.com/gridsmartercities/pywsitest" }, "release_url": "https://pypi.org/project/pywsitest/0.2.1/", "requires_dist": [ "websockets" ], "requires_python": "", "summary": "PYthon WebSocket Integration TESTing framework", "version": "0.2.1" }, "last_serial": 5619477, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "abb91dbe29ad7d8be498dc8594154c1e", "sha256": "cfbb7c39d22575d1c56d243d23124190b4b79e18449db425f60034091dab501f" }, "downloads": -1, "filename": "pywsitest-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "abb91dbe29ad7d8be498dc8594154c1e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6426, "upload_time": "2019-07-22T12:50:44", "url": "https://files.pythonhosted.org/packages/87/b5/023c568a80a7451c29b206e5ede71b186b4e5736c3a76af9725c7b4f8363/pywsitest-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6c923bad90523cff7e4974d3b8f38e3c", "sha256": "03116ffeba6dd18e175ddca471e178f0b505e6d67da9bf2b5fd04ead5c72c69c" }, "downloads": -1, "filename": "pywsitest-0.1.tar.gz", "has_sig": false, "md5_digest": "6c923bad90523cff7e4974d3b8f38e3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4463, "upload_time": "2019-07-22T12:50:47", "url": "https://files.pythonhosted.org/packages/18/51/734e9941af10c9b293609b742c0a73fbb7e45e5eeea66cb5937eebd1190e/pywsitest-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "3d77bbde5375910fd4b8b4eb18346858", "sha256": "4de248cbf521ca74bf147dd4cc4fa45c4ff637efa3af03b63103732e48d2d033" }, "downloads": -1, "filename": "pywsitest-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "3d77bbde5375910fd4b8b4eb18346858", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7730, "upload_time": "2019-07-26T14:35:48", "url": "https://files.pythonhosted.org/packages/cc/fd/40e1dad951d00d7f968b2bb5d120e7a6c6991f36386fa3589b0d62d8079e/pywsitest-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da8537001028e114505a059ae9e29b1c", "sha256": "b228497c40323e0de32d11e5ef513a3b14b9caf5506631cd8de8191fd3e90629" }, "downloads": -1, "filename": "pywsitest-0.2.tar.gz", "has_sig": false, "md5_digest": "da8537001028e114505a059ae9e29b1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5547, "upload_time": "2019-07-26T14:35:50", "url": "https://files.pythonhosted.org/packages/93/67/5a59d8d2469e1699c65e9cb642b0e49ed03eae1f17bf43bcc1d0ee2c61b8/pywsitest-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "5dd3d27af891b0760584d3c752c2f508", "sha256": "b17a3332fbce45780ca943aa9581e2634642bbdbbf3f1899311d1da54ed8aa6b" }, "downloads": -1, "filename": "pywsitest-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5dd3d27af891b0760584d3c752c2f508", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7933, "upload_time": "2019-08-01T15:40:49", "url": "https://files.pythonhosted.org/packages/04/5c/5e31548f015c5963945c59fc87b7919a54a911814874438d5e8a2babdb30/pywsitest-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2aadec2758a08e40223cdbaa8904ed02", "sha256": "8dc33b1b6c71722fd4c34a317ef3dfe4f4eb066f7b202dd0f44dd5fa9f2731c0" }, "downloads": -1, "filename": "pywsitest-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2aadec2758a08e40223cdbaa8904ed02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5709, "upload_time": "2019-08-01T15:40:51", "url": "https://files.pythonhosted.org/packages/53/fd/9c30d43e412e13ef587fbba70eea6d2664874ac4547d7f349b3dde81c5a0/pywsitest-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5dd3d27af891b0760584d3c752c2f508", "sha256": "b17a3332fbce45780ca943aa9581e2634642bbdbbf3f1899311d1da54ed8aa6b" }, "downloads": -1, "filename": "pywsitest-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5dd3d27af891b0760584d3c752c2f508", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7933, "upload_time": "2019-08-01T15:40:49", "url": "https://files.pythonhosted.org/packages/04/5c/5e31548f015c5963945c59fc87b7919a54a911814874438d5e8a2babdb30/pywsitest-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2aadec2758a08e40223cdbaa8904ed02", "sha256": "8dc33b1b6c71722fd4c34a317ef3dfe4f4eb066f7b202dd0f44dd5fa9f2731c0" }, "downloads": -1, "filename": "pywsitest-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2aadec2758a08e40223cdbaa8904ed02", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5709, "upload_time": "2019-08-01T15:40:51", "url": "https://files.pythonhosted.org/packages/53/fd/9c30d43e412e13ef587fbba70eea6d2664874ac4547d7f349b3dde81c5a0/pywsitest-0.2.1.tar.gz" } ] }