{"id":13501427,"url":"https://github.com/gridsmartercities/pywsitest","last_synced_at":"2026-01-14T10:20:32.090Z","repository":{"id":46088974,"uuid":"195247176","full_name":"gridsmartercities/pywsitest","owner":"gridsmartercities","description":"PYthon WebSocket Integration TESTing framework","archived":true,"fork":false,"pushed_at":"2021-11-15T10:51:19.000Z","size":203,"stargazers_count":28,"open_issues_count":3,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-29T09:02:10.813Z","etag":null,"topics":["integration-testing","python","python-package","python3","testing-framework","websockets"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gridsmartercities.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T13:29:09.000Z","updated_at":"2024-07-09T11:13:11.000Z","dependencies_parsed_at":"2022-08-30T18:01:48.328Z","dependency_job_id":null,"html_url":"https://github.com/gridsmartercities/pywsitest","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/gridsmartercities/pywsitest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridsmartercities%2Fpywsitest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridsmartercities%2Fpywsitest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridsmartercities%2Fpywsitest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridsmartercities%2Fpywsitest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gridsmartercities","download_url":"https://codeload.github.com/gridsmartercities/pywsitest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridsmartercities%2Fpywsitest/sbom","scorecard":{"id":445567,"data":{"date":"2025-08-11","repo":{"name":"github.com/gridsmartercities/pywsitest","commit":"7d438477bfc61b6e3adeab6530f52a24359249d8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build_publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_publish.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build_publish.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_publish.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_publish.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_publish.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build_publish.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/gridsmartercities/pywsitest/build_publish.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/build_publish.yml:30","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned","Info:   0 out of   1 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.3.1 not signed: https://api.github.com/repos/gridsmartercities/pywsitest/releases/24208186","Warn: release artifact v0.3 not signed: https://api.github.com/repos/gridsmartercities/pywsitest/releases/23729743","Warn: release artifact v0.3.1 does not have provenance: https://api.github.com/repos/gridsmartercities/pywsitest/releases/24208186","Warn: release artifact v0.3 does not have provenance: https://api.github.com/repos/gridsmartercities/pywsitest/releases/23729743"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: PYSEC-2021-95 / GHSA-8ch4-58qp-g3mp","Warn: Project is vulnerable to: PYSEC-2018-79"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T06:38:48.173Z","repository_id":46088974,"created_at":"2025-08-19T06:38:48.173Z","updated_at":"2025-08-19T06:38:48.173Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:18:03.274Z","status":"ssl_error","status_checked_at":"2026-01-14T10:16:11.865Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration-testing","python","python-package","python3","testing-framework","websockets"],"created_at":"2024-07-31T22:01:37.163Z","updated_at":"2026-01-14T10:20:32.076Z","avatar_url":"https://github.com/gridsmartercities.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[\u003cimg align=\"right\" alt=\"Grid Smarter Cities\" src=\"https://s3.eu-west-2.amazonaws.com/open-source-resources/grid_smarter_cities_small.png\"\u003e](https://www.gridsmartercities.com/)\n\n![Build Status](https://codebuild.eu-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiSitwRmNUcHk2VzN2VS8rMHdUS2hoNzZCQUdCME1VV0RkeWEwTmZyVUxOWUdXR2hMTzVUVWIvLzJ5ZFR2SWo5OHhtSm55TFc4SjZvcGhNcndNT1lDbEdRPSIsIml2UGFyYW1ldGVyU3BlYyI6Ik9SV0g1Tm1FMUVERW9RSzciLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D\u0026branch=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_header**: add a header 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_request**: attach a rest api request to the instance of this class\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_request_timeout**: set the timeout in seconds for the rest request attached to the instance of this class\n- **with_test_timeout**: set the timeout in seconds for the test runner to run for\n- **with_received_response_logging**: enable logging of received responses on response timeout error\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### [RestRequest](https://github.com/gridsmartercities/pywsitest/blob/master/pywsitest/rest_request.py)\nRestRequest is a class to represent a request to send to rest api\n- **with_header**: add a header to the request to be sent to the rest api\n- **with_body**: add a body to the request to be sent to the rest api\n- **with_delay**: add a delay to the request to be sent to the rest api\n\n## Examples\n\n### Response testing\nTesting a response 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\nTesting that a response with the following more complicated body is received on connection to a websocket host:\n```json\n{\n    \"body\": {\n        \"attribute\": \"value\"\n    }\n}\n```\n\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        .with_attribute(\"body/attribute\", \"value\")\n    )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\nTesting that a response with the following body with a list is received on connection to a websocket host:\n```json\n{\n    \"body\": [\n        {\"colour\": \"red\"},\n        {\"colour\": \"green\"},\n        {\"colour\": \"blue\"}\n    ]\n}\n```\n\n```py\nfrom pywsitest import WSTest, WSResponse\n\nws_test = (\n    WSTest(\"wss://example.com\")\n    .with_response(\n        WSResponse()\n        .with_attribute(\"body/0/colour\", \"red\")\n        .with_attribute(\"body/1/colour\", \"green\")\n        .with_attribute(\"body/2/colour\", \"blue\")\n    )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\nTesting that a response with the following body with a list containing the colour `green` somewhere is received on connection to a websocket host:\n```json\n{\n    \"body\": [\n        {\"colour\": \"red\"},\n        {\"colour\": \"green\"},\n        {\"colour\": \"blue\"}\n    ]\n}\n```\n\n```py\nfrom pywsitest import WSTest, WSResponse\n\nws_test = (\n    WSTest(\"wss://example.com\")\n    .with_response(\n        WSResponse()\n        .with_attribute(\"body//colour\", \"green\")\n    )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\n### Message sending\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 with extracted data 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/message\")\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\nTriggering a message to be sent with the first colour extracted from a list when the following response is received:\n```json\n{\n    \"body\": [\n        {\"colour\": \"red\"},\n        {\"colour\": \"green\"},\n        {\"colour\": \"blue\"}\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/0/colour\")\n        .with_trigger(\n            WSMessage()\n            .with_attribute(\"body\", \"${body/0/colour}\")\n        )\n    )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\n### Using rest requests\nAttaching simple rest get request and sending it:\n```py\nrest_request = (\n    RestRequest(\"https://example.com\", \"GET\")\n    .with_body({\"some_key\": some_value})\n)\n\nws_test = (\n    WSTest(\"wss://example.com\")\n    .with_request(rest_request)\n)\n\nawait ws_test.run()\n\nfor response in ws_tester.received_request_responses:\n    print(response.status_code)\n    print(response.json())\n\nassert ws_test.is_complete()\n```\n\n### Error handling\nForce a test to fail is execution takes more than 30 seconds (default 60 seconds)\n```py\nws_test = (\n    WSTest(\"wss://example.com\")\n    .with_test_timeout(30)\n    .with_response(\n        WSResponse()\n        .with_attribute(\"body\")\n    )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\nForce a test to fail if no response is received for 15 seconds (default 10 seconds) \n- Any responses that haven't been sent will be output along with the `WSTimeoutError`\n- Received responses can be output too by calling `with_received_response_logging` on the `WSTest` instance\n```py\nws_test = (\n    WSTest(\"wss://example.com\")\n    .with_response_timeout(15)\n    .with_received_response_logging()\n    .with_response(\n        WSResponse()\n        .with_attribute(\"body\")\n    )\n)\n\nawait ws_test.run()\n\nassert ws_test.is_complete()\n```\n\nForce a test to fail is a message takes longer than 15 seconds to send (default 10 seconds)\n- The message that the test runner failed to send will be output along with the `WSTimeoutError`\n```py\nws_test = (\n    WSTest(\"wss://example.com\")\n    .with_message_timeout(15)\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\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)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgridsmartercities%2Fpywsitest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgridsmartercities%2Fpywsitest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgridsmartercities%2Fpywsitest/lists"}