pca-scenery


Namepca-scenery JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryVersatile integration tests for django app views
upload_time2024-12-16 13:31:56
maintainerEtienne Madinier
docs_urlNone
authorEtienne Madinier
requires_python>=3.11
licenseMIT License Copyright (c) 2024 [Pointcarre.app] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords test integration django view app
VCS
bugtrack_url
requirements asgiref beautifulsoup4 bs4 Django PyYAML soupsieve sqlparse
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![License](https://img.shields.io/pypi/l/YOUR-PACKAGE-NAME.svg)](https://github.com/pointcarre-app/pca-scenery/blob/master/LICENSE)

[![PyPI version](https://img.shields.io/pypi/v/pca-scenery.svg)](https://pypi.org/project/pca-scenery/)
[![Python versions](https://img.shields.io/pypi/pyversions/pca-scenery.svg)](https://pypi.org/project/pca-scenery/)

[![Test](https://github.com/pointcarre-app/pca-scenery/actions/workflows/test.yml/badge.svg)](https://github.com/pointcarre-app/pca-scenery/actions/workflows/test.yml)
[![Ruff](https://img.shields.io/github/actions/workflow/status/pointcarre-app/pca-scenery/python-checks.yml?label=Ruff&logo=ruff&job=ruff)](https://github.com/pointcarre-app/pca-scenery/actions/workflows/python-checks.yml?job=ruff)
[![Mypy](https://img.shields.io/github/actions/workflow/status/pointcarre-app/pca-scenery/python-checks.yml?label=Mypy&logo=python&job=mypy)](https://github.com/pointcarre-app/pca-scenery/actions/workflows/python-checks.yml?job=mypy)

[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://pointcarre-app.github.io/pca-scenery)


# scenery

`scenery` simplifies writing extensive and maintainable integration tests for your Django application while keeping your testing codebase DRY.

![Scenery Demo](https://path/to/your/demo.gif)

## Features

- Human-readable YAML configuration files for test scenarios
- Launch your entire test suite with a single command
- Full control over set-up and tear-down actions
- Easily share data across multiple tests
- Flexible and extensible directive system for response validation

## Installation

Install `scenery` using pip:

```bash
pip install pca-scenery
```

## Usage

### Test Manifests

With `scenery`, integration tests are configured using YAML, a human-readable data serialization language, making maintenance easy for developers. A given YAML file is called a __manifest__.

In a manifest, a test is described by a __scene__ which defines the request to a given URL and the checks (called __directives__) that should be applied to the HTTP response.

#### Example 1: Simple GET request

```yaml
scene:
  method: GET
  url: "index"
  directives:
    - status_code: 200
```

This test sends a GET request to the '/index' URL and checks if the returned status code is 200.

#### Example 2: POST request with data

```yaml
cases:
  CASE_A:
    item_1:
        foo: 0
  CASE_B:
    item_1:
        foo: 1

scene:
  method: POST
  url: "item"
  data:
    item_id: !case item_1:foo
  directives:
    - status_code: 200
```

This test sends a POST request to the '/item' URL with `{item_id: 0}` and `{item_id: 1}` as data and checks if the returned status code is 200.

### Advanced Features

The full syntax of `scenery` allows you to:

- Test a given scene with different data sets
- Shared data for use across multiple tests
- Have full control over set-up and tear-down methods
- Leverage YAML syntax to parsimonly define your tests
<!-- - Define custom directives for specialized checks -->



### Settings

`scenery` relies on 4 environment variables, which can be easily provided by a `scenery_settings.py` file at the root of your project (or any location you prefer).


```python
# scenery_settings.py
SCENERY_MANIFESTS_FOLDER = "path/to/your/manifests"
SCENERY_COMMON_ITEMS = "path/to/shared/data.yml"
SCENERY_SET_UP_INSTRUCTIONS = "path/to/your/set_up_tear_down_functions"
SCENERY_TESTED_APP_NAME = "your_app_name"
```



### Running Tests

You also need to provide the Django settings you want to use. To run your tests, use the following command:

```bash
python -m scenery --django_settings=your_project.settings.test
```

You can also add additional command-line arguments to filter tests, set verbosity, etc. Run `python -m scenery --help` for more information.

For more detailed information, please visit our [official documentation](https://pointcarre-app.github.io/pca-scenery/).

## Contributing

We welcome contributions to `scenery`! Here are some ways you can contribute:

1. Report bugs or request features by opening an issue
2. Improve documentation
3. Submit pull requests with bug fixes or new features

Please read our [Contributing Guide]([CONTRIBUTING.md](https://pointcarre-app.github.io/pca-scenery/contributing)) for more details.

## License

`scenery` is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Credits

`scenery` was created by Etienne Madinier.

It relies on great open-source projects:
- [Beautifulsoup4](https://pypi.org/project/beautifulsoup4/)
- [Django](https://www.djangoproject.com/)
- [PyYAML](https://pypi.org/project/PyYAML/)
- [MyPy](https://mypy-lang.org/)
- [Ruff](https://github.com/astral-sh/ruff)

---

For more information, examples, and advanced usage, please visit our [official documentation](https://pointcarre-app.github.io/pca-scenery/).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pca-scenery",
    "maintainer": "Etienne Madinier",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "test, integration, django, view, app",
    "author": "Etienne Madinier",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/3d/60/60a7392a988deb759e24239073c2c27556a7f83fdc7bc024bfb201e20868/pca_scenery-0.1.8.tar.gz",
    "platform": null,
    "description": "[![License](https://img.shields.io/pypi/l/YOUR-PACKAGE-NAME.svg)](https://github.com/pointcarre-app/pca-scenery/blob/master/LICENSE)\n\n[![PyPI version](https://img.shields.io/pypi/v/pca-scenery.svg)](https://pypi.org/project/pca-scenery/)\n[![Python versions](https://img.shields.io/pypi/pyversions/pca-scenery.svg)](https://pypi.org/project/pca-scenery/)\n\n[![Test](https://github.com/pointcarre-app/pca-scenery/actions/workflows/test.yml/badge.svg)](https://github.com/pointcarre-app/pca-scenery/actions/workflows/test.yml)\n[![Ruff](https://img.shields.io/github/actions/workflow/status/pointcarre-app/pca-scenery/python-checks.yml?label=Ruff&logo=ruff&job=ruff)](https://github.com/pointcarre-app/pca-scenery/actions/workflows/python-checks.yml?job=ruff)\n[![Mypy](https://img.shields.io/github/actions/workflow/status/pointcarre-app/pca-scenery/python-checks.yml?label=Mypy&logo=python&job=mypy)](https://github.com/pointcarre-app/pca-scenery/actions/workflows/python-checks.yml?job=mypy)\n\n[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://pointcarre-app.github.io/pca-scenery)\n\n\n# scenery\n\n`scenery` simplifies writing extensive and maintainable integration tests for your Django application while keeping your testing codebase DRY.\n\n![Scenery Demo](https://path/to/your/demo.gif)\n\n## Features\n\n- Human-readable YAML configuration files for test scenarios\n- Launch your entire test suite with a single command\n- Full control over set-up and tear-down actions\n- Easily share data across multiple tests\n- Flexible and extensible directive system for response validation\n\n## Installation\n\nInstall `scenery` using pip:\n\n```bash\npip install pca-scenery\n```\n\n## Usage\n\n### Test Manifests\n\nWith `scenery`, integration tests are configured using YAML, a human-readable data serialization language, making maintenance easy for developers. A given YAML file is called a __manifest__.\n\nIn a manifest, a test is described by a __scene__ which defines the request to a given URL and the checks (called __directives__) that should be applied to the HTTP response.\n\n#### Example 1: Simple GET request\n\n```yaml\nscene:\n  method: GET\n  url: \"index\"\n  directives:\n    - status_code: 200\n```\n\nThis test sends a GET request to the '/index' URL and checks if the returned status code is 200.\n\n#### Example 2: POST request with data\n\n```yaml\ncases:\n  CASE_A:\n    item_1:\n        foo: 0\n  CASE_B:\n    item_1:\n        foo: 1\n\nscene:\n  method: POST\n  url: \"item\"\n  data:\n    item_id: !case item_1:foo\n  directives:\n    - status_code: 200\n```\n\nThis test sends a POST request to the '/item' URL with `{item_id: 0}` and `{item_id: 1}` as data and checks if the returned status code is 200.\n\n### Advanced Features\n\nThe full syntax of `scenery` allows you to:\n\n- Test a given scene with different data sets\n- Shared data for use across multiple tests\n- Have full control over set-up and tear-down methods\n- Leverage YAML syntax to parsimonly define your tests\n<!-- - Define custom directives for specialized checks -->\n\n\n\n### Settings\n\n`scenery` relies on 4 environment variables, which can be easily provided by a `scenery_settings.py` file at the root of your project (or any location you prefer).\n\n\n```python\n# scenery_settings.py\nSCENERY_MANIFESTS_FOLDER = \"path/to/your/manifests\"\nSCENERY_COMMON_ITEMS = \"path/to/shared/data.yml\"\nSCENERY_SET_UP_INSTRUCTIONS = \"path/to/your/set_up_tear_down_functions\"\nSCENERY_TESTED_APP_NAME = \"your_app_name\"\n```\n\n\n\n### Running Tests\n\nYou also need to provide the Django settings you want to use. To run your tests, use the following command:\n\n```bash\npython -m scenery --django_settings=your_project.settings.test\n```\n\nYou can also add additional command-line arguments to filter tests, set verbosity, etc. Run `python -m scenery --help` for more information.\n\nFor more detailed information, please visit our [official documentation](https://pointcarre-app.github.io/pca-scenery/).\n\n## Contributing\n\nWe welcome contributions to `scenery`! Here are some ways you can contribute:\n\n1. Report bugs or request features by opening an issue\n2. Improve documentation\n3. Submit pull requests with bug fixes or new features\n\nPlease read our [Contributing Guide]([CONTRIBUTING.md](https://pointcarre-app.github.io/pca-scenery/contributing)) for more details.\n\n## License\n\n`scenery` is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Credits\n\n`scenery` was created by Etienne Madinier.\n\nIt relies on great open-source projects:\n- [Beautifulsoup4](https://pypi.org/project/beautifulsoup4/)\n- [Django](https://www.djangoproject.com/)\n- [PyYAML](https://pypi.org/project/PyYAML/)\n- [MyPy](https://mypy-lang.org/)\n- [Ruff](https://github.com/astral-sh/ruff)\n\n---\n\nFor more information, examples, and advanced usage, please visit our [official documentation](https://pointcarre-app.github.io/pca-scenery/).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 [Pointcarre.app]  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Versatile integration tests for django app views",
    "version": "0.1.8",
    "project_urls": {
        "Bug Tracker": "https://github.com/pointcarre-app/pca-scenery/issues",
        "Documentation": "https://pointcarre-app.github.io/pca-scenery/",
        "Homepage": "https://pointcarre.app",
        "Repository": "https://github.com/pointcarre-app/pca-scenery.git"
    },
    "split_keywords": [
        "test",
        " integration",
        " django",
        " view",
        " app"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9ce30fbf604add91717adb2b810f818a29962bb23be55fed1be1a2d7a8bfa04",
                "md5": "f045a430007ee1f886b5ea12d2225a9c",
                "sha256": "243811cfad3692da4836a971f45aa98b7e5c42c350d393e2d4801f1d942afe03"
            },
            "downloads": -1,
            "filename": "pca_scenery-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f045a430007ee1f886b5ea12d2225a9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 24061,
            "upload_time": "2024-12-16T13:31:51",
            "upload_time_iso_8601": "2024-12-16T13:31:51.616898Z",
            "url": "https://files.pythonhosted.org/packages/d9/ce/30fbf604add91717adb2b810f818a29962bb23be55fed1be1a2d7a8bfa04/pca_scenery-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3d6060a7392a988deb759e24239073c2c27556a7f83fdc7bc024bfb201e20868",
                "md5": "2e7ea4ad15fc5ccf15389e397448df65",
                "sha256": "750782add451e24ec4c284ba2f1e9978c6a8ff54bd39a7718af2b38877239025"
            },
            "downloads": -1,
            "filename": "pca_scenery-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "2e7ea4ad15fc5ccf15389e397448df65",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 20230,
            "upload_time": "2024-12-16T13:31:56",
            "upload_time_iso_8601": "2024-12-16T13:31:56.396777Z",
            "url": "https://files.pythonhosted.org/packages/3d/60/60a7392a988deb759e24239073c2c27556a7f83fdc7bc024bfb201e20868/pca_scenery-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 13:31:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pointcarre-app",
    "github_project": "pca-scenery",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "asgiref",
            "specs": [
                [
                    "==",
                    "3.8.1"
                ]
            ]
        },
        {
            "name": "beautifulsoup4",
            "specs": [
                [
                    "==",
                    "4.12.3"
                ]
            ]
        },
        {
            "name": "bs4",
            "specs": [
                [
                    "==",
                    "0.0.1"
                ]
            ]
        },
        {
            "name": "Django",
            "specs": [
                [
                    "==",
                    "4.2.7"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    "==",
                    "6.0.1"
                ]
            ]
        },
        {
            "name": "soupsieve",
            "specs": [
                [
                    "==",
                    "2.6"
                ]
            ]
        },
        {
            "name": "sqlparse",
            "specs": [
                [
                    "==",
                    "0.5.1"
                ]
            ]
        }
    ],
    "lcname": "pca-scenery"
}
        
Elapsed time: 0.45142s