Name | robotframework-fasthttpmock JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | HTTP mock server library for Robot Framework using FastAPI and Uvicorn |
upload_time | 2025-02-11 07:05:04 |
maintainer | None |
docs_url | None |
author | Leela Prasad V |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2024 Leela Prasad V
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
robotframework
testing
mock
http
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# robotframework-fasthttpmock
HTTP mock server library for Robot Framework powered by FastAPI. This library enables easy mocking of HTTP endpoints in your Robot Framework tests with minimal setup and configuration.
## Features
- ๐ Lightweight and fast mock server using FastAPI
- ๐ค Simple Robot Framework keywords
- ๐ Dynamic mock interaction management
- โ
Request verification capabilities
- ๐งน Automatic server cleanup
- ๐ Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH)
## Installation
```bash
pip install robotframework-fasthttpmock
```
The editable mode (`-e`) allows you to modify the source code and see the changes immediately without reinstalling.
## Available Keywords
| Keyword | Description |
|---------|-------------|
| `Start Mock Server` | Start the mock HTTP server with optional host and port |
| `Stop Mock Server` | Gracefully stop the mock server |
| `Add Mock Interaction` | Add a new mock interaction with request/response definitions |
| `Remove Mock Interaction` | Remove an existing mock interaction |
| `Verify Interaction Called` | Verify the number of times an interaction was called |
## Quick Start
Here's a simple example of how to use the library in your Robot Framework tests:
```robot
*** Settings ***
Library FastHTTPMock
Library RequestsLibrary
*** Test Cases ***
Mock Simple API Response
Start Mock Server port=8000
# Define mock interaction
${request}= Create Dictionary method=GET path=/api/users
${response}= Create Dictionary status=200 body={"users": ["user1", "user2"]}
${id}= Add Mock Interaction ${request} ${response}
# Make request to mock server
${resp}= GET http://localhost:8000/api/users
Should Be Equal As Strings ${resp.status_code} 200
# Verify the interaction
Verify Interaction Called ${id} 1
[Teardown] Stop Mock Server
```
## Advanced Usage
### Multiple Endpoints Example
```robot
*** Test Cases ***
Mock Multiple API Endpoints
Start Mock Server port=8000
# Mock GET endpoint
${get_request}= Create Dictionary method=GET path=/api/users/1
${get_response}= Create Dictionary status=200 body={"id": 1, "name": "John Doe"}
${get_id}= Add Mock Interaction ${get_request} ${get_response}
# Mock POST endpoint
${post_request}= Create Dictionary method=POST path=/api/users
${post_response}= Create Dictionary status=201 body={"message": "User created"}
${post_id}= Add Mock Interaction ${post_request} ${post_response}
# Test both endpoints
${get_resp}= GET http://localhost:8000/api/users/1
Should Be Equal As Strings ${get_resp.status_code} 200
${post_resp}= POST http://localhost:8000/api/users
Should Be Equal As Strings ${post_resp.status_code} 201
[Teardown] Stop Mock Server
```
## Contributing
Refer to [Contributing Docs](./CONTRIBUTING.md) for more details
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Run tests and ensure they pass
4. Commit your changes (`git commit -m 'Add some amazing feature'`)
5. Push to the branch (`git push origin feature/amazing-feature`)
6. Open a Pull Request
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
If you encounter any issues or have questions:
1. Check the [Issues](https://github.com/leelaprasadv/robotframework-fasthttpmock/issues) page
2. Create a new issue if your problem isn't already listed
## Acknowledgments
- Inspired by [PactumJS](https://github.com/pactumjs/pactum)
- Built with [FastAPI](https://fastapi.tiangolo.com/)
- Made for [Robot Framework](https://robotframework.org/)
Raw data
{
"_id": null,
"home_page": null,
"name": "robotframework-fasthttpmock",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "robotframework, testing, mock, http",
"author": "Leela Prasad V",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7f/76/d62b07efb9efe0d9b34be61c1cc9427f79b5a8d86ce53fdcc55e2514d4fe/robotframework_fasthttpmock-0.2.0.tar.gz",
"platform": null,
"description": "# robotframework-fasthttpmock\n\nHTTP mock server library for Robot Framework powered by FastAPI. This library enables easy mocking of HTTP endpoints in your Robot Framework tests with minimal setup and configuration.\n\n## Features\n\n- \ud83d\ude80 Lightweight and fast mock server using FastAPI\n- \ud83e\udd16 Simple Robot Framework keywords\n- \ud83d\udd04 Dynamic mock interaction management\n- \u2705 Request verification capabilities\n- \ud83e\uddf9 Automatic server cleanup\n- \ud83c\udf10 Support for all HTTP methods (GET, POST, PUT, DELETE, PATCH)\n\n## Installation\n```bash\npip install robotframework-fasthttpmock\n```\n\nThe editable mode (`-e`) allows you to modify the source code and see the changes immediately without reinstalling.\n\n## Available Keywords\n\n| Keyword | Description |\n|---------|-------------|\n| `Start Mock Server` | Start the mock HTTP server with optional host and port |\n| `Stop Mock Server` | Gracefully stop the mock server |\n| `Add Mock Interaction` | Add a new mock interaction with request/response definitions |\n| `Remove Mock Interaction` | Remove an existing mock interaction |\n| `Verify Interaction Called` | Verify the number of times an interaction was called |\n\n## Quick Start\n\nHere's a simple example of how to use the library in your Robot Framework tests:\n\n```robot\n*** Settings ***\nLibrary FastHTTPMock\nLibrary RequestsLibrary\n\n*** Test Cases ***\nMock Simple API Response\n Start Mock Server port=8000\n \n # Define mock interaction\n ${request}= Create Dictionary method=GET path=/api/users\n ${response}= Create Dictionary status=200 body={\"users\": [\"user1\", \"user2\"]}\n ${id}= Add Mock Interaction ${request} ${response}\n \n # Make request to mock server\n ${resp}= GET http://localhost:8000/api/users\n Should Be Equal As Strings ${resp.status_code} 200\n \n # Verify the interaction\n Verify Interaction Called ${id} 1\n [Teardown] Stop Mock Server\n```\n\n\n\n## Advanced Usage\n\n### Multiple Endpoints Example\n```robot\n*** Test Cases ***\nMock Multiple API Endpoints\n Start Mock Server port=8000\n \n # Mock GET endpoint\n ${get_request}= Create Dictionary method=GET path=/api/users/1\n ${get_response}= Create Dictionary status=200 body={\"id\": 1, \"name\": \"John Doe\"}\n ${get_id}= Add Mock Interaction ${get_request} ${get_response}\n \n # Mock POST endpoint\n ${post_request}= Create Dictionary method=POST path=/api/users\n ${post_response}= Create Dictionary status=201 body={\"message\": \"User created\"}\n ${post_id}= Add Mock Interaction ${post_request} ${post_response}\n \n # Test both endpoints\n ${get_resp}= GET http://localhost:8000/api/users/1\n Should Be Equal As Strings ${get_resp.status_code} 200\n ${post_resp}= POST http://localhost:8000/api/users\n Should Be Equal As Strings ${post_resp.status_code} 201\n [Teardown] Stop Mock Server\n```\n\n## Contributing\n\nRefer to [Contributing Docs](./CONTRIBUTING.md) for more details\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Run tests and ensure they pass\n4. Commit your changes (`git commit -m 'Add some amazing feature'`)\n5. Push to the branch (`git push origin feature/amazing-feature`)\n6. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Support\n\nIf you encounter any issues or have questions:\n1. Check the [Issues](https://github.com/leelaprasadv/robotframework-fasthttpmock/issues) page\n2. Create a new issue if your problem isn't already listed\n\n## Acknowledgments\n\n- Inspired by [PactumJS](https://github.com/pactumjs/pactum)\n- Built with [FastAPI](https://fastapi.tiangolo.com/)\n- Made for [Robot Framework](https://robotframework.org/)\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2024 Leela Prasad V\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE. ",
"summary": "HTTP mock server library for Robot Framework using FastAPI and Uvicorn",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/leelaprasadv/robotframework-fasthttpmock",
"Repository": "https://github.com/leelaprasadv/robotframework-fasthttpmock.git"
},
"split_keywords": [
"robotframework",
" testing",
" mock",
" http"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c13d95a71895f70c5117d3f3c8602954b80352d5bd2338fbbc757bf5c2bb95c0",
"md5": "a97643ff0c4887da7ec93187ce64620a",
"sha256": "b3670c9e91b93b257131102004cd543d7ad1c480c30c71854cf3bbb92f32e5e0"
},
"downloads": -1,
"filename": "robotframework_fasthttpmock-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a97643ff0c4887da7ec93187ce64620a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11479,
"upload_time": "2025-02-11T07:05:02",
"upload_time_iso_8601": "2025-02-11T07:05:02.843764Z",
"url": "https://files.pythonhosted.org/packages/c1/3d/95a71895f70c5117d3f3c8602954b80352d5bd2338fbbc757bf5c2bb95c0/robotframework_fasthttpmock-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7f76d62b07efb9efe0d9b34be61c1cc9427f79b5a8d86ce53fdcc55e2514d4fe",
"md5": "9f77cd7a385dbd066041967161ea94b3",
"sha256": "ec064032c7bd14b8ab88a61857c3d5a1b218ea0b50f735384ad6e15a240c7a6a"
},
"downloads": -1,
"filename": "robotframework_fasthttpmock-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "9f77cd7a385dbd066041967161ea94b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9314,
"upload_time": "2025-02-11T07:05:04",
"upload_time_iso_8601": "2025-02-11T07:05:04.690139Z",
"url": "https://files.pythonhosted.org/packages/7f/76/d62b07efb9efe0d9b34be61c1cc9427f79b5a8d86ce53fdcc55e2514d4fe/robotframework_fasthttpmock-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-11 07:05:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "leelaprasadv",
"github_project": "robotframework-fasthttpmock",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "robotframework-fasthttpmock"
}