Skip to main content

Test Storytelling for requests

Project description

lemoncheesecake-requests provides logging facilities to requests for tests written with the lemoncheesecake test framework.

In this example, we implement a very basic test on a Github API endpoint:

# suites/github.py

import lemoncheesecake.api as lcc
from lemoncheesecake.matching import *
from lemoncheesecake_requests import Session, is_2xx

@lcc.test()
def get_org():
    session = Session(base_url="https://api.github.com")

    resp = session.get("/orgs/lemoncheesecake")
    resp.require_status_code(is_2xx())

    check_that_in(
        resp.json(),
        "id", is_integer(),
        "name", equal_to("lemoncheesecake")
    )

We run the test:

$ lcc.py run
=================================== github ====================================
 OK  1 # github.get_org

Statistics :
 * Duration: 0.214s
 * Tests: 1
 * Successes: 1 (100%)
 * Failures: 0

And here is the report details :

test result

Installation

Install through pip:

$ pip install lemoncheesecake-requests

lemoncheesecake-requests is compatible with Python 3.6-3.9.

Features

  • request/response data logging into lemoncheesecake

  • response status code checking using lemoncheesecake matching mechanism

Documentation

The documentation is available on https://lemoncheesecake-requests.readthedocs.io.

Contact

Bug reports and improvement ideas are welcomed in tickets. A Google Groups forum is also available for discussions about lemoncheesecake: https://groups.google.com/forum/#!forum/lemoncheesecake.

Project details


Download files

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

Source Distribution

lemoncheesecake-requests-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file lemoncheesecake-requests-0.1.1.tar.gz.

File metadata

  • Download URL: lemoncheesecake-requests-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for lemoncheesecake-requests-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0cee44f3a807992f74f7450023bafeb5c326e696ef20fdca42eb800574d5e1e6
MD5 8ee4116655cad741c8b5f870c7d670ed
BLAKE2b-256 2995061a43ff506dd8812fe852b9688c9fdfa1ac2be4aa1a4573a8bd8f77558b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page