Skip to main content

Library to simplify writing HTTP REST service integration tests

Project description

Library to simplify writing HTTP REST service integration tests.

Allows to build a HTTP REST client with automatic resource cleanup.


from http_test_client import Client, HttpTransport, RestResources, resources

class ArticleResources(RestResources):
    def search(self, query):
        return self._request('/search', method='POST', data={'query': query})

    class Resource(RestResources.Resource):
        def publish(self):
            return self._request('/publish', method='POST')

        comments = resources('/comments')

class MyClient(Client):
    users = resources('/users')
    articles = resources('/articles', ArticleResources)

client = MyClient(HttpTransport('http://localhost:8888'))

# managing resources
client.users.list() # => [{'id': '1', 'name': 'John'}, ...]
client.users.create({'name': 'Jane'}) # => {'id': '2'}
client.users['1'].get() # => {'id': '1', 'name': 'John'}

# delete all resources that were created during this client session

# custom action

# nested resources


$ pip install http-test-client


  • Python >= 2.7 and <= 3.6
  • requests >= 2.14
  • six >= 1.10


MIT licensed. See the bundled LICENSE file for more details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for http-test-client, version 0.3.2
Filename, size File type Python version Upload date Hashes
Filename, size http_test_client-0.3.2-py2.py3-none-any.whl (6.6 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size http_test_client-0.3.2.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page