Skip to main content

utilities to help you validate Tavern response.

Project description

tavalidate, utilities to help you validate Tavern response.

Installation

Tavalidate can be installed through pip.

pip install tavalidate

XML

Tavern has great built-in Json support, but things are difficult when it comes to XML. Use tavalidate.xmlv package to validate XML response.

XML validation example:

response:
  body:
    $ext:
      function: tavalidate.xmlv:assert_xml
      extra_kwargs:
        expected: |
          <foo attr="!anystr">
            <bar attr2="baz">!anyint</bar>
          </foo>

Simply put, pass the expected xml as an argument to the tavalidate.xmlv.validate function. The function will validate the xml structure, node value and attribute value.

extra_kwargs

Below are the supported extra kwargs of tavalidate.xmlv.validate function.

expected

This is the expected XML string.

You may use some (not all) of the tavern magic values to match data of your specified type:

  • !anything: This matches value of any type.
  • !anystr: Matches any string
  • !anyint: Matches any integer
  • !anyfloat: Matches any float
  • !anybool: Matches any boolean

strict

Use strict: True if you want to make sure there's no extra tag in the response.

Logging

Configure the logger tavalidate so you can see the response body in DEBUG level.

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 tavalidate, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size tavalidate-0.0.3.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page