Validator plugin for Vedro testing framework
Project description
Vedro Valera Validator
⚠️ 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:
- Install the package using pip:
$ pip3 install vedro-valera-validator
- Next, activate the plugin in your
vedro.cfg.pyconfiguration 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
541eaa21b59772812becec5ed2c50f3f335971813825831423c5510ee17ddf0b
|
|
| MD5 |
7460f2f140dbb8194a4f2265a24d134b
|
|
| BLAKE2b-256 |
29f455bc6a98d95c715af81f2f81aca2ef56f00560f585bbf0881d8482a94de7
|
File details
Details for the file vedro_valera_validator-1.2.1-py3-none-any.whl.
File metadata
- Download URL: vedro_valera_validator-1.2.1-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
622fe9a70d016ad818ee0c2bdae35f414e35f83568112d2fe0459edcd6f771dd
|
|
| MD5 |
f86c181da902f3a274d9a1adbb992225
|
|
| BLAKE2b-256 |
67871638c8abeea38ec156eba6bce229db33900f51352c7c28e95bc2a85464a6
|