Skip to main content

Test Storytelling for requests

Project description

https://github.com/lemoncheesecake/lemoncheesecake-requests/actions/workflows/tests.yml/badge.svg https://codecov.io/gh/lemoncheesecake/lemoncheesecake-requests/branch/master/graph/badge.svg https://img.shields.io/pypi/v/lemoncheesecake-requests.svg https://img.shields.io/pypi/pyversions/lemoncheesecake-requests.svg

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"). \
      require_status_code(is_2xx()). \
      check_json({
        "id": is_integer(),
        "name": equal_to("lemoncheesecake")
      })

We run the test:

$ lcc 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.7-3.10.

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.4.0.tar.gz (8.0 kB view hashes)

Uploaded Source

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