Simple flask API that connects to a 3rd party API (Plaid) in order to read, store (in memory), and serve some data.
Using the sandbox environment of Plaid. Build a simple API with the following resources:
Resource | Method | BODY | RESPONSE |
---|---|---|---|
/ | GET | - | 200 "Healthy" |
/exchange | POST | {“public_token”: “<public_token>”} | 201 |
/query | POST | - |
|
/account | GET | - | 200 & response from “/query” |
Create and activate local environment
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
Deploy locally
python3 application.py
Now it is working in http://127.0.0.1:5000/
Only execute
py.test -vv --disable-pytest-warnings
I had used pytest-ordering to avoid cache problems between tests
http://flask-env.eba-pxrp9ipm.us-east-2.elasticbeanstalk.com/
Local and AWS https://www.getpostman.com/collections/b301c1865c145436f3bf
- Create account in Plaid
- Create Integration test suit
- Build the resource API skeleton
- Create methods to call the API
- Complete the test suit
- Create an AWS instance and deploy it
- Postman collection
-
As it is a test in a sandbox environment and to facilitate the tests by third parties, I have not encrypted the sensitive information to connect with the Plaid API. Of course, this is something to be avoided in real projects (using AWS env or GitHub Actions for example).
-
I have preferred to use http requests directly because Plaid PostMan collection has better explained and completed than Plaid python library documentation.
-
For the same reason of Note 1, I have not configured any security in AWS instance (all directions allowed). Obviously it is only for a test case.