Skip to main content

Validator for Vedro framework

Project description

Vedro Valera Validator

Codecov PyPI PyPI - Downloads Python Version

Installation

1. Install package

$ pip3 install vedro-valera-validator

2. Enable plugin

# ./vedro.cfg.py
import vedro
import vedro_valera_validator as v


class Config(vedro.Config):

    class Plugins(vedro.Config.Plugins):

        class ValeraValidator(v.ValeraValidator):
            enabled = True

Usage

# ./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 tests

$ vedro run
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.0.1.tar.gz (7.0 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.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file vedro-valera-validator-1.0.1.tar.gz.

File metadata

  • Download URL: vedro-valera-validator-1.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for vedro-valera-validator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4c11bae78a1950729f03e091d6f09f253456f614e12e589e4e2ee3acc3aaa12a
MD5 c1720766da16d559996017a0ee5ce3f1
BLAKE2b-256 74e76330a95bb8e60074c435b2ca53823416b12cb2bdbecdec6f8b5bd7c586b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for vedro_valera_validator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ef177a86b0538f06b40935f715047b741eab1e29e1bcd3791d1f89cca491644
MD5 16aaf098a212aa2ce3e97c4eeb508883
BLAKE2b-256 3eebfbecf303d7f25afa07f9f3682258a10f6d01a34d699a0bf45ba025289c6f

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