vedro-valera-validator


Namevedro-valera-validator JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/vedro-universe/vedro-valera-validator
SummaryValidator plugin for Vedro testing framework
upload_time2024-10-21 16:28:33
maintainerNone
docs_urlNone
authorNikita Tsvetkov
requires_python>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements vedro d42
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Vedro Valera Validator

[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-valera-validator/master.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-valera-validator)
[![PyPI](https://img.shields.io/pypi/v/vedro-valera-validator.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-valera-validator/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-valera-validator?style=flat-square)](https://pypi.python.org/pypi/vedro-valera-validator/)
[![Python Version](https://img.shields.io/pypi/pyversions/vedro-valera-validator.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-valera-validator/)

[vedro-valera-validator](https://pypi.org/project/vedro-valera-validator/) is a plugin for the Vedro framework that utilizes the [valera validator](https://pypi.org/project/valera), a package designed for data validation based on [d42 (district42) schemas](https://d42.vedro.io/docs/quick-start). Valera validator provides a simple yet powerful approach to ensure your data aligns perfectly with your expectations.

## Installation

<details open>
<summary>Quick</summary>
<p>

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

```shell
$ vedro plugin install vedro-valera-validator
```

</p>
</details>

<details>
<summary>Manual</summary>
<p>

To install manually, follow these steps:

1. Install the package using pip:

```shell
$ pip3 install vedro-valera-validator
```

2. Next, activate the plugin in your `vedro.cfg.py` configuration file:

```python
# ./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
```

</p>
</details>

## Usage

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

```python
# ./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:

```shell
$ vedro run
```

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

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

## Additional Resources

For a detailed guide and further information, check out the  [documentation](https://vedro.io/docs/integrations/valera-validator).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vedro-universe/vedro-valera-validator",
    "name": "vedro-valera-validator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Nikita Tsvetkov",
    "author_email": "tsv1@fastmail.com",
    "download_url": "https://files.pythonhosted.org/packages/01/40/1a78b7012ede515a5548ff6b5d0296f996f5faf5f1c4871faff47d34bcc3/vedro_valera_validator-1.2.0.tar.gz",
    "platform": null,
    "description": "# Vedro Valera Validator\n\n[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-valera-validator/master.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-valera-validator)\n[![PyPI](https://img.shields.io/pypi/v/vedro-valera-validator.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-valera-validator/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-valera-validator?style=flat-square)](https://pypi.python.org/pypi/vedro-valera-validator/)\n[![Python Version](https://img.shields.io/pypi/pyversions/vedro-valera-validator.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-valera-validator/)\n\n[vedro-valera-validator](https://pypi.org/project/vedro-valera-validator/) is a plugin for the Vedro framework that utilizes the [valera validator](https://pypi.org/project/valera), a package designed for data validation based on [d42 (district42) schemas](https://d42.vedro.io/docs/quick-start). Valera validator provides a simple yet powerful approach to ensure your data aligns perfectly with your expectations.\n\n## Installation\n\n<details open>\n<summary>Quick</summary>\n<p>\n\nFor a quick installation, you can use a plugin manager as follows:\n\n```shell\n$ vedro plugin install vedro-valera-validator\n```\n\n</p>\n</details>\n\n<details>\n<summary>Manual</summary>\n<p>\n\nTo install manually, follow these steps:\n\n1. Install the package using pip:\n\n```shell\n$ pip3 install vedro-valera-validator\n```\n\n2. Next, activate the plugin in your `vedro.cfg.py` configuration file:\n\n```python\n# ./vedro.cfg.py\nimport vedro\nimport vedro_valera_validator\n\nclass Config(vedro.Config):\n\n    class Plugins(vedro.Config.Plugins):\n\n        class ValeraValidator(vedro_valera_validator.ValeraValidator):\n            enabled = True\n```\n\n</p>\n</details>\n\n## Usage\n\nHere is an example scenario demonstrating how to decode a base64 encoded string:\n\n```python\n# ./scenarios/decode_base64_encoded_string.py\nimport vedro\nfrom base64 import b64decode\nfrom d42 import schema\n\nclass Scenario(vedro.Scenario):\n    subject = \"decode base64 encoded string\"\n\n    def given(self):\n        self.encoded = \"Y3VjdW1iZXI=\"\n\n    def when(self):\n        self.result = {\n            \"result\": b64decode(self.encoded)\n        }\n\n    def then(self):\n        assert self.result == schema.dict({\n            \"result\": schema.bytes(b\"banana\")\n        })\n```\n\nRun the test using the command:\n\n```shell\n$ vedro run\n```\n\nIf the expected and actual results don't match, a `ValidationException` will be raised, as illustrated below:\n\n```shell\nValidationException:\n - Value <class 'bytes'> at _['result'] must be equal to b'banana', but b'cucumber' given\n ```\n\n## Additional Resources\n\nFor a detailed guide and further information, check out the  [documentation](https://vedro.io/docs/integrations/valera-validator).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Validator plugin for Vedro testing framework",
    "version": "1.2.0",
    "project_urls": {
        "Docs": "https://vedro.io/docs/integrations/valera-validator",
        "GitHub": "https://github.com/vedro-universe/vedro-valera-validator",
        "Homepage": "https://github.com/vedro-universe/vedro-valera-validator"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a2d686ff614938ba57ba12c31c52727106cbf70dcd96af98f6b0fc8be5ecc26",
                "md5": "5bacea13f6555c59edaaa79ea848ced6",
                "sha256": "4ec3027bb4f0806efa298be936226c0b8856615a3320695156512c454b0ea642"
            },
            "downloads": -1,
            "filename": "vedro_valera_validator-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5bacea13f6555c59edaaa79ea848ced6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7861,
            "upload_time": "2024-10-21T16:28:31",
            "upload_time_iso_8601": "2024-10-21T16:28:31.633958Z",
            "url": "https://files.pythonhosted.org/packages/3a/2d/686ff614938ba57ba12c31c52727106cbf70dcd96af98f6b0fc8be5ecc26/vedro_valera_validator-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01401a78b7012ede515a5548ff6b5d0296f996f5faf5f1c4871faff47d34bcc3",
                "md5": "01d0eb9e6fb7d377b4d84f023873093b",
                "sha256": "ed09b79a48b0489a265e40ee98a77856145f08d94dbe839db2031ab64425fd20"
            },
            "downloads": -1,
            "filename": "vedro_valera_validator-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "01d0eb9e6fb7d377b4d84f023873093b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8061,
            "upload_time": "2024-10-21T16:28:33",
            "upload_time_iso_8601": "2024-10-21T16:28:33.164528Z",
            "url": "https://files.pythonhosted.org/packages/01/40/1a78b7012ede515a5548ff6b5d0296f996f5faf5f1c4871faff47d34bcc3/vedro_valera_validator-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 16:28:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vedro-universe",
    "github_project": "vedro-valera-validator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "vedro",
            "specs": [
                [
                    ">=",
                    "1.5"
                ],
                [
                    "<",
                    "2.0"
                ]
            ]
        },
        {
            "name": "d42",
            "specs": [
                [
                    ">=",
                    "1.5"
                ],
                [
                    "<",
                    "3.0"
                ]
            ]
        }
    ],
    "lcname": "vedro-valera-validator"
}
        
Elapsed time: 0.33992s