https://github.com/rishant/python_command_design_pattern_client
main - python_cli_command_utility_v2
https://github.com/rishant/python_command_design_pattern_client
Last synced: 7 months ago
JSON representation
main - python_cli_command_utility_v2
- Host: GitHub
- URL: https://github.com/rishant/python_command_design_pattern_client
- Owner: rishant
- Created: 2024-07-07T11:51:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-08T18:10:11.000Z (over 1 year ago)
- Last Synced: 2025-04-05T06:29:47.609Z (10 months ago)
- Language: Python
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# python client using command design pattern CLI | database | MongoDB | Rest Api | kafka
cmd:/> python runner.py --command odr_create_order --json-data "{\"order_id\": \"123\", \"item\": \"book\", \"quantity\": 2}"
cmd:/> python runner.py --command odr_create_order --json-data '{"order_id": "123", "item": "book", "quantity": 2}'
cmd:/> python runner.py --command cancel_order --json-data '{"order_id": "123"}'
cmd:/> python runner.py --command process_payment --json-data '{"payment_id": "456", "amount": 100.0}'
cmd:/> python runner.py --command refund_payment --json-data '{"payment_id": "456"}'
cmd:/> python runner.py --command create_user --mongo-uri 'mongodb://localhost:27017/' --json-data '{"username": "john_doe", "email": "john@example.com", "password": "password123"}'
cmd:/> python runner.py --command get_external_posts --api_uri 'https://jsonplaceholder.typicode.com/posts' --json-data '{"username": "john_doe", "email": "john@example.com", "password": "password123"}'
## skip `__pycache__` compiled code generation
set PYTHONDONTWRITEBYTECODE=1
python -m unittest discover -s tests
## Create `run_tests.py` script and execute it
import os
import unittest
os.environ['PYTHONDONTWRITEBYTECODE'] = '1'
# Discover and run tests
loader = unittest.TestLoader()
tests = loader.discover('tests')