{"id":20741742,"url":"https://github.com/m-roberts/py-mockoon","last_synced_at":"2026-05-28T11:31:05.838Z","repository":{"id":237432803,"uuid":"599351225","full_name":"m-roberts/py-mockoon","owner":"m-roberts","description":"A Python client for administering mock server, requests and responses for testing with mockoon CLI","archived":false,"fork":false,"pushed_at":"2023-05-08T22:46:10.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T23:27:06.302Z","etag":null,"topics":["mock","mock-server","mockoon","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m-roberts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-09T00:32:37.000Z","updated_at":"2023-05-07T16:11:38.000Z","dependencies_parsed_at":"2024-05-01T19:06:55.672Z","dependency_job_id":"979a286f-d9da-4404-bb7d-c5fb5006ca0b","html_url":"https://github.com/m-roberts/py-mockoon","commit_stats":null,"previous_names":["m-roberts/py-mockoon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/m-roberts/py-mockoon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-roberts%2Fpy-mockoon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-roberts%2Fpy-mockoon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-roberts%2Fpy-mockoon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-roberts%2Fpy-mockoon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-roberts","download_url":"https://codeload.github.com/m-roberts/py-mockoon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-roberts%2Fpy-mockoon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33607334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["mock","mock-server","mockoon","python","python3"],"created_at":"2024-11-17T06:42:54.268Z","updated_at":"2026-05-28T11:31:05.816Z","avatar_url":"https://github.com/m-roberts.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyMockoon\n\n## Overview\n\n`PyMockoon` is a Python library that provides an easy way to start, stop, and manage mock servers using Mockoon as a backend. It can leverage the native `mockoon-cli` command or Docker to run the mock server.\n\nThe library is inspired by Python's `unittest` mocking system and helps users create extensive test suites by providing the ability to assert and verify HTTP transactions.\n\n### Features\n\n- Start and stop mock servers using Mockoon or Mockoon Docker image\n- Provide mock server definition/specification using a Mockoon environment JSON file\n- Log all HTTP transactions\n- Assert HTTP transactions with the following methods:\n  - assert_not_called()\n  - assert_called()\n  - assert_called_once()\n  - assert_called_once_with(request)\n  - assert_called_with(request)\n  - assert_has_calls(requests, any_order)\n  - reset_transactions()\n\nThe methods can be used to assert various conditions related to the HTTP transactions made to the mock server.\n\n#### Example Usage\n\n```python\nimport pathlib\nfrom http import HTTPStatus\nimport requests\nfrom mockoon import MockoonServer, Request\n\ndata_file = \"path/to/file.json\"\n\nserver = MockoonServer(data_file=data_file, use_docker=True)\n\nserver.start()\n\nserver.assert_not_called()\n\nresponse = requests.get(f\"{server.root_uri}/hello\")\nassert response.status_code == HTTPStatus.OK\n\nserver.wait_for_route_hit(\"hello\")\n\nserver.stop()\n\nserver.assert_called()\nserver.assert_called_once()\n\n# Currently the request needs to be checked by hand\nexpected_request = Request(\n  body=\"\",\n  headers={\n    \"accept\": \"*/*\",\n    \"accept-encoding\": \"gzip, deflate\",\n    \"connection\": \"keep-alive\",\n    \"host\": \"localhost:3000\",\n    \"user-agent\": \"python-requests/2.30.0\",\n  },\n  method=\"GET\",\n  params={},\n  query=\"\",\n  queryParams={},\n  route=\"/hello\",\n  urlPath=\"/hello\",\n)\n\nserver.assert_called_once_with(request=expected_request)\nserver.assert_called_with(request=expected_request)\nserver.assert_has_calls(requests=[expected_request])\n\nserver.reset_transactions()\nserver.assert_not_called()\n```\n\n## Requirements\n\n- Python 3.9+\n- Mockoon CLI (required if not using Mockoon Docker image)\n- Docker (optional, required if using Mockoon Docker image)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-roberts%2Fpy-mockoon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-roberts%2Fpy-mockoon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-roberts%2Fpy-mockoon/lists"}