Skip to main content

Library to simplify writing HTTP REST service integration tests.

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

Example

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'}
client.users['1'].delete()

# delete all resources that were created during this client session
client.cleanup()

# custom action
client.articles['123'].publish()

# nested resources
client.articles['123'].comments.list()

Installation

$ pip install http-test-client

Requirements

  • Python >= 2.7 and <= 3.6

  • requests >= 2.14

  • six >= 1.10

License

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

Metadata

Release files for http-test-client 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for http-test-client 0.3.2
File Size Uploaded Provenance
http_test_client-0.3.2.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for http-test-client 0.3.2
File Interpreter ABI Platform
http_test_client-0.3.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.2 kB

Release files / http_test_client-0.3.2.tar.gz

Download URL http_test_client-0.3.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c5fce02c84ceba05fcc28fc742ed73b9f9dcc1cf71c8649a91413b93c311a7b3
BLAKE2b-256 checksum
How to use checksums
20ac918658f2f4c83720b249965583f65ae013ec9517a9afb86ff58e191abc8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / http_test_client-0.3.2-py2.py3-none-any.whl

Download URL http_test_client-0.3.2-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
58ff645d5ee53e1d6d2560744242221982902e8d9c6733ea81d3cbfd14ab6426
BLAKE2b-256 checksum
How to use checksums
db341d32dc7d4a2e28bfc616d17b85986ee022ad303cc6b4b04c69c2db0862a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for http-test-client 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page