Send push notification from command line for single or multiple targets
Project description
Mock server to return static response.
Install
pip install pymocky
Check with command:
pymocky -h
How to use
pymocky -p extras/sample/
Test with command (need curl):
curl http://localhost:9000/login
To change from default scenario to other use (server need be running):
pymocky --update-scenario "login-error"
Test again with command (need curl):
curl http://localhost:9000/login
Example of YAML file
mappings:
- id: hello_world
scenario: login-success
request:
url: .*pymock_hello_world.*
method: post
query_string: .*param1=value¶m2=value2
form_fields:
username: .*demo
password: .*12345
headers:
"Content-Type": "application/json"
body: .*Hello World.*
response:
headers:
"Content-Type": "application/json"
body_raw: Hello world from pymocky!
body_file: files/dummy.xml
body_json:
success: false
data:
errors: []
body_image: images/image1.png
You can use “body_raw”, “body_file”, “body_json” or “body_image” as response type.
body_raw: Raw text as response
body_file: File content with mimetype discovery by extension
body_json: Json as YAML object or string
body_image: Image file with mimetype discovery by extension
Change scenario
To change from default scenario to other use (server need be running):
pymocky --update-scenario "login-error"
Testing
You need install test dependencies with the command:
pip install -r requirements_tests.txt
To execute all tests use the command:
python -m pytest tests
To coverage test use the command:
python -m pytest --cov=. --cov-report=xml --cov-report=html tests
To install locally during development:
python setup.py install
Packaging
To package and upload for distribution on PyPi server use:
python setup.py upload
Contributing
Fork the project and clone locally.
Create a new branch for what you’re going to work on.
Push to your origin repository.
Create a new pull request in GitHub.
Buy me a coffee
Supported By Jetbrains IntelliJ IDEA
License
Copyright (c) 2020-present, Paulo Coutinho
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pymocky-1.0.0-2.tar.gz
.
File metadata
- Download URL: pymocky-1.0.0-2.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c3bd529cd6a5e62c225db7767faa436d994d4e889a1054ef94d19ec5406b77a |
|
MD5 | a9bd7c112a6d024e949512a007da0225 |
|
BLAKE2b-256 | 76d5ddaad2e23d87a3df0ce47dda962787a5c0ca2bef2b5c9b7048ed2c07d5e2 |
File details
Details for the file pymocky-1.0.0-2-py2.py3-none-any.whl
.
File metadata
- Download URL: pymocky-1.0.0-2-py2.py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b811638db364aa70dc1bfee9979d81e42903c6ac2fad3d406f56abc8f3dd6e69 |
|
MD5 | d9b05d39b3c90c70e1f661eab6635f6b |
|
BLAKE2b-256 | 6883868325f43822c73f6b480f69e97521e209ce6880cdd3b4f0a25e04cac1f0 |