Skip to main content

Validator plugin for Vedro testing framework

Project description

Vedro Valera Validator

Codecov PyPI PyPI - Downloads Python Version

⚠️ This package has been renamed to vedro-d42-validator. The vedro-valera-validator package on PyPI is no longer maintained. For updates and improvements, please use vedro-d42-validator going forward.

Installation

Quick

For a quick installation, you can use a plugin manager as follows:

$ vedro plugin install vedro-valera-validator

Manual

To install manually, follow these steps:

  1. Install the package using pip:
$ pip3 install vedro-valera-validator
  1. Next, activate the plugin in your vedro.cfg.py configuration file:
# ./vedro.cfg.py
import vedro
import vedro_valera_validator

class Config(vedro.Config):

    class Plugins(vedro.Config.Plugins):

        class ValeraValidator(vedro_valera_validator.ValeraValidator):
            enabled = True

Usage

Here is an example scenario demonstrating how to decode a base64 encoded string:

# ./scenarios/decode_base64_encoded_string.py
import vedro
from base64 import b64decode
from d42 import schema

class Scenario(vedro.Scenario):
    subject = "decode base64 encoded string"

    def given(self):
        self.encoded = "Y3VjdW1iZXI="

    def when(self):
        self.result = {
            "result": b64decode(self.encoded)
        }

    def then(self):
        assert self.result == schema.dict({
            "result": schema.bytes(b"banana")
        })

Run the test using the command:

$ vedro run

If the expected and actual results don't match, a ValidationException will be raised, as illustrated below:

ValidationException:
 - Value <class 'bytes'> at _['result'] must be equal to b'banana', but b'cucumber' given

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

vedro_valera_validator-1.2.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vedro_valera_validator-1.2.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file vedro_valera_validator-1.2.1.tar.gz.

File metadata

  • Download URL: vedro_valera_validator-1.2.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for vedro_valera_validator-1.2.1.tar.gz
Algorithm Hash digest
SHA256 541eaa21b59772812becec5ed2c50f3f335971813825831423c5510ee17ddf0b
MD5 7460f2f140dbb8194a4f2265a24d134b
BLAKE2b-256 29f455bc6a98d95c715af81f2f81aca2ef56f00560f585bbf0881d8482a94de7

See more details on using hashes here.

File details

Details for the file vedro_valera_validator-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for vedro_valera_validator-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 622fe9a70d016ad818ee0c2bdae35f414e35f83568112d2fe0459edcd6f771dd
MD5 f86c181da902f3a274d9a1adbb992225
BLAKE2b-256 67871638c8abeea38ec156eba6bce229db33900f51352c7c28e95bc2a85464a6

See more details on using hashes here.

Supported by

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