Setup | Running Tests | Writing Tests | Debugging | Internals | Code of Conduct
- Fork & clone the repository:
git clone https://github.com//Mpesa-Based_Wi-Fi-Hotspot_Billing_System cd Mpesa-Based_Wi-Fi-Hotspot_Billing_System
Create & activate virtual environment:
python -m venv venv source venv/bin/activate
python -m venv venv venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Configure environment variables in .env:
FLASK_APP=app.py FLASK_ENV=development DATABASE_URL=sqlite:///database.db MPESA_CONSUMER_KEY= MPESA_CONSUMER_SECRET=
Initialize database & run:
python manage.py init-db flask run Running Tests
pytest tests/
pytest tests/test_payments.py
pytest tests/test_payments.py::test_payment_success
pytest --cov=app tests/ Writing Tests
Place tests in tests/ folder with test_.py naming.
Example:
def test_hotspot_login(client): response = client.post("/login", data={"username": "user", "password": "pass"}) assert response.status_code == 200 assert b"Welcome" in response.data
Use Python debugger:
import pdb; pdb.set_trace()
Or use breakpoints in VS Code / PyCharm.
app.py β Flask entry point
payments.py β M-Pesa integration
hotspot.py β Hotspot login & billing
models.py β Database models
templates/ β HTML templates
static/ β CSS/JS assets
tests/ β Unit & integration tests
Fork repository & create a branch.
Implement your changes.
Add tests in tests/.
Ensure all tests pass.
Submit a pull request describing your feature.
Be respectful, welcoming, and constructive.
No harassment, personal attacks, or sharing private info.
Maintain professionalism in all interactions.
Enforcement Contact: mwakidenice@gmail.com
Full Code of Conduct: CODE_OF_CONDUCT.md