Metadata-Version: 2.1
Name: pytest-django-rq
Version: 0.2.0
Summary: A pytest plugin to help writing unit test for django-rq
Home-page: https://github.com/ein-plus/pytest-django-rq
Author: Qiangning Hong
Author-email: hongqn@ein.plus
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: pytest-mock
Requires-Dist: fakeredis

# pytest-django-rq


A pytest plugin to help writing unit test for django-rq.

<p align="center">
<a href="https://github.com/ein-plus/pytest-django-rq/actions?query=workflow%3Abuild"><img alt="build" src="https://github.com/ein-plus/pytest-django-rq/workflows/build/badge.svg"></a>
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

This plugin provides a `django_rq_worker` fixture which has a `work()` method
to run all enqueued jobs in current process.


## Usage

```python
def test_async_api(django_rq_worker):
    client = django.test.Client()

    # Call an async API
    response = client.post(URL)
    assert response.status_code == 201  # Accepted

    # now let's run all enqueued jobs
    django_rq_worker.work()

    # assert the async jobs has taken place.
    assert ...
```


