Mini wallet API backend service with Django
- Initialize wallet account
- Enable & disabled wallet
- View Wallet
- View Transaction
- Deposit & withdrawn money
- Python 3.8+
- Docker
-
clone source code from github
-
go to project directory
cd wallet-backend-django
-
create your own project env
python3 -m venv env
-
activate your project env
source env/bin/activate
-
go to your project directory and install requirement.txt
pip install requirement.txt
-
run docker compose
docker compose up -d
-
migrate all models to database.
python3 manage.py migrate
-
then run the apps.
python3 manage.py runserver
-
run test case.
python3 manage.py test
the output should be like this:
Found 8 test(s). Creating test database for alias 'default'... System check identified no issues (0 silenced). ........ ---------------------------------------------------------------------- Ran 8 tests in 2.507s OK Destroying test database for alias 'default'...
-
run test coverage.
coverage run --source='.' manage.py test src.wallet coverage report
the output should be like this:
Found 8 test(s). Creating test database for alias 'default'... System check identified no issues (0 silenced). ........ ---------------------------------------------------------------------- Ran 8 tests in 2.512s OK Destroying test database for alias 'default'... Name Stmts Miss Cover ----------------------------------------------------------- manage.py 12 2 83% src/__init__.py 0 0 100% src/asgi.py 4 4 0% src/settings.py 21 0 100% src/urls.py 2 0 100% src/wallet/__init__.py 0 0 100% src/wallet/admin.py 1 0 100% src/wallet/apps.py 4 0 100% src/wallet/decorators.py 36 0 100% src/wallet/factory.py 21 0 100% src/wallet/migrations/0001_initial.py 8 0 100% src/wallet/migrations/__init__.py 0 0 100% src/wallet/models.py 46 6 87% src/wallet/serializers.py 53 0 100% src/wallet/tests.py 128 0 100% src/wallet/urls.py 3 0 100% src/wallet/utils.py 4 0 100% src/wallet/views.py 102 0 100% src/wsgi.py 4 4 0% ----------------------------------------------------------- TOTAL 449 16 96%
You can try API with postman by import the collection and environment file