Skip to content

rossdrew/REST-Endpoint-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

license Build Status Code Climate

Endpoint Simulator

Python script to spin up some simple REST endpoints for simulating services.

Usage

To spin up an endpoint, create a Python script in the same directory, make sure there is a web.py style URL mapping/class tuple structure to define the mapping and what endpoint class it should point to. Like so:-

urls = ('/Test', 'test')

Add (as in web.py) a class with a method with the name of the HTTP method type of the expected request, e.g. GET and specify behaviour.

class test:        
    def GET(self):
    	print "TEST HIT"
        return "Test Endpoint!"

It is run by running the script followed by the port it should run on, followed by a list of endpoint packages you wish to spin up, e.g.

python endpointSim.py 8081 Test

Unit tests are run automatically and halt the script if they fail but they can be run by themselves like so

python -m doctest endpointSim.py

Examples

Included here are two examples:-

  • Test.py : An example enpoint that provides a response
  • AuthTest.py: An example endpoint with basic auth & JSON returned

About

A simple endpoint simulator platform in python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages