# vedro-jj
[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-jj/master.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-jj)
[![PyPI](https://img.shields.io/pypi/v/vedro-jj.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-jj/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-jj?style=flat-square)](https://pypi.python.org/pypi/vedro-jj/)
[![Python Version](https://img.shields.io/pypi/pyversions/vedro-jj.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-jj/)
[Vedro](https://vedro.io/) + [jj](https://pypi.org/project/jj/)
## Installation
<details open>
<summary>Quick</summary>
<p>
For a quick installation, you can use a plugin manager as follows:
```shell
$ vedro plugin install vedro-jj
```
</p>
</details>
<details>
<summary>Manual</summary>
<p>
To install manually, follow these steps:
1. Install the package using pip:
```shell
$ pip3 install vedro-jj
```
2. Next, activate the plugin in your `vedro.cfg.py` configuration file:
```python
# ./vedro.cfg.py
import vedro
import vedro_jj
class Config(vedro.Config):
class Plugins(vedro.Config.Plugins):
class VedroJJ(vedro_jj.VedroJJ):
enabled = True
```
</p>
</details>
## Usage
```python
import httpx
import jj
import vedro
from jj.mock import mocked
class Scenario(vedro.Scenario):
subject = "get users"
def given(self):
self.mock_matcher = jj.match("GET", "/users")
self.mock_response = jj.Response(json=[])
def when(self):
with mocked(self.mock_matcher, self.mock_response):
self.response = httpx.get("http://localhost:8080/users")
def then(self):
assert self.response.status_code == 200
assert self.response.json() == []
```
```shell
$ vedro run -vv
```
Raw data
{
"_id": null,
"home_page": "https://github.com/vedro-universe/vedro-jj",
"name": "vedro-jj",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Nikita Tsvetkov",
"author_email": "tsv1@fastmail.com",
"download_url": "https://files.pythonhosted.org/packages/c8/1c/21624283a040021e22041bf0f5141cc8e0ee744ae1922f68700779a850dd/vedro-jj-0.2.0.tar.gz",
"platform": null,
"description": "# vedro-jj\n\n[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-jj/master.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-jj)\n[![PyPI](https://img.shields.io/pypi/v/vedro-jj.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-jj/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-jj?style=flat-square)](https://pypi.python.org/pypi/vedro-jj/)\n[![Python Version](https://img.shields.io/pypi/pyversions/vedro-jj.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-jj/)\n\n[Vedro](https://vedro.io/) + [jj](https://pypi.org/project/jj/)\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-jj\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-jj\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_jj\n\nclass Config(vedro.Config):\n\n class Plugins(vedro.Config.Plugins):\n\n class VedroJJ(vedro_jj.VedroJJ):\n enabled = True\n```\n\n</p>\n</details>\n\n## Usage\n\n```python\nimport httpx\nimport jj\nimport vedro\nfrom jj.mock import mocked\n\nclass Scenario(vedro.Scenario):\n subject = \"get users\"\n\n def given(self):\n self.mock_matcher = jj.match(\"GET\", \"/users\")\n self.mock_response = jj.Response(json=[])\n\n def when(self):\n with mocked(self.mock_matcher, self.mock_response):\n self.response = httpx.get(\"http://localhost:8080/users\")\n\n def then(self):\n assert self.response.status_code == 200\n assert self.response.json() == []\n```\n\n```shell\n$ vedro run -vv\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "",
"version": "0.2.0",
"project_urls": {
"GitHub": "https://github.com/vedro-universe/vedro-jj",
"Homepage": "https://github.com/vedro-universe/vedro-jj"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9bf6612ac8754c35215f8271245b904ee11e4f147014bf5ca5da291d9faf02c9",
"md5": "902476a8c93c0d972f1d92f268ba6f1d",
"sha256": "e20c92333bf373657c310dfddfaa2e2c56d905e77a557252a037f4fa5acb72e5"
},
"downloads": -1,
"filename": "vedro_jj-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "902476a8c93c0d972f1d92f268ba6f1d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 8352,
"upload_time": "2023-06-12T17:51:24",
"upload_time_iso_8601": "2023-06-12T17:51:24.334145Z",
"url": "https://files.pythonhosted.org/packages/9b/f6/612ac8754c35215f8271245b904ee11e4f147014bf5ca5da291d9faf02c9/vedro_jj-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c81c21624283a040021e22041bf0f5141cc8e0ee744ae1922f68700779a850dd",
"md5": "b2cb59f1438b37ebd20a35c919f14dd5",
"sha256": "171a48d60ef4ded52ef9683022cd99b1c6f1d94c8d3a19e6e45df3392d478169"
},
"downloads": -1,
"filename": "vedro-jj-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "b2cb59f1438b37ebd20a35c919f14dd5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9373,
"upload_time": "2023-06-12T17:51:25",
"upload_time_iso_8601": "2023-06-12T17:51:25.803383Z",
"url": "https://files.pythonhosted.org/packages/c8/1c/21624283a040021e22041bf0f5141cc8e0ee744ae1922f68700779a850dd/vedro-jj-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-12 17:51:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vedro-universe",
"github_project": "vedro-jj",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "vedro-jj"
}