https://github.com/codecademy/add-automated-tests-off-platform-project
https://github.com/codecademy/add-automated-tests-off-platform-project
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codecademy/add-automated-tests-off-platform-project
- Owner: Codecademy
- Created: 2021-11-17T21:40:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T16:21:50.000Z (over 1 year ago)
- Last Synced: 2025-04-01T08:37:16.487Z (12 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 6
- Watchers: 7
- Forks: 1,686
- Open Issues: 196
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BankAccount
This is an educational public repository to illustrate the power of automated testing through Github Actions.
## Run locally
1. Set up Python virtual environment.
```
python -m venv venv
```
2. Install required dependencies.
```
pip install -r requirements.txt
```
3. Run unit tests.
```
python -m pytest
```
4. Run the app.
```
python app.py
```
## Code Description
1. app.py: A flask application that exposes the following API endpoints:
- index at / : Retun a JSON data structure indicating the current balance.
- deposit at /deposit : Take the deposit amount as a URL parameter and return the new balance after adding the amount.
- withdraw at /withdraw : Take the withdrawal amount as a URL parameter and return the new balance after subtracting the amount.
App relies on a global in-memory variable (`balance`) to store the balance of the account.
2. requirements.txt: A text file including all the Python libraries and packages needed to run the app.
3. .gitignore: Refer to the gitignore article for more details. In short, this file makes it possible that local configuration or binary files are not pushed to the repository.
4. tests: It's a directory that includes several unit tests for the APIs. The tests utilize the PyTest library.