Have you ever faced issues with intergration testing of your applications? Ever frowned upon by some developer because your APIs are not ready for testing? Ever slowed down by backend developer for your front-end work?
Py-api-stub helps you to turn JSON files to powerful APIs service.
Put in JSON files in a particular folder structure and boom, your API stub is ready.
Consider that you have an api - POST /customer/profile. With py-api-stub, place a post.json
file with following folder structure - apis/customer/profile/post.json
. The json file will have the response expected from the API
Yes, what you guessed is right. The file name should be the verb (HTTP method) name. And yes, your second guess is right. The folder structure is same as your API structure.
Formulating this:
VERB /x/y/z
=>./apis/x/y/z/verb.json
GET /customer/[[customerID]]/profile
=> ./apis/customer/:customerID/profile/get.json
Path variables should start with
:
- default responses for APIs for each of the method
- handle path variables
- test cases for each of the feature
- add response codes
- static response based on path variables
- simple programmable apis (use an id counter, return the body, etc)
- add XML support ?
- Build the docker using -
$ docker build -t py-api-stub .
- The app runs on port 5000 in the Docker and 8000 on the host
- Command:
$ docker-compose up
- API is now available on http://localhost:8000
API responses are maintained in the ./apis
folder.
- create an issue and discuss the requirements and way you plan to develop it
- create a branch with the name
feat/<issue-id>
- raise a pull request to master.