-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New Tests: tests/unit/api/test_container.py * New Tests: tests/unit/api/test_base.py * New Tests: tests/unit/api/test_backend.py * New Tests: tests/unit/api/test_broker.py * New Tests: tests/unit/api/test_worker.py * New Tests: tests/unit/api/test_setup.py * New Tests: tests/unit/vendors/test_worker.py * New Tests: tests/unit/vendors/test_memcached.py * New Tests: tests/unit/vendors/test_rabbitmq.py * New Tests: tests/unit/vendors/test_redis.py
- Loading branch information
Showing
17 changed files
with
383 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
import pytest | ||
from celery import Celery | ||
from pytest_lazyfixture import lazy_fixture | ||
|
||
from pytest_celery import CELERY_BACKEND | ||
from pytest_celery import CELERY_BACKEND_CLUSTER | ||
from pytest_celery import DEFAULT_WORKER_ENV | ||
from pytest_celery import CeleryBackendCluster | ||
from pytest_celery import CeleryTestBackend | ||
|
||
|
||
@pytest.mark.parametrize("backend", [lazy_fixture(CELERY_BACKEND)]) | ||
class test_celey_test_backend: | ||
def test_default_config_format(self, backend: CeleryTestBackend): | ||
expected_format = {"url", "local_url"} | ||
assert set(backend.default_config().keys()) == expected_format | ||
assert backend.default_config()["url"] == DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"] | ||
assert backend.default_config()["local_url"] == DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"] | ||
|
||
def test_restart_no_app(self, backend: CeleryTestBackend): | ||
assert backend.app is None | ||
backend.restart() | ||
|
||
def test_restart_with_app(self, backend: CeleryTestBackend, celery_setup_app: Celery): | ||
backend._app = celery_setup_app | ||
assert "result_backend" not in celery_setup_app.conf.changes | ||
backend.restart() | ||
assert "result_backend" in celery_setup_app.conf.changes | ||
|
||
|
||
@pytest.mark.parametrize("cluster", [lazy_fixture(CELERY_BACKEND_CLUSTER)]) | ||
class test_celery_backend_cluster: | ||
def test_default_config_format(self, cluster: CeleryBackendCluster): | ||
expected_format = {"urls", "local_urls"} | ||
assert set(cluster.default_config().keys()) == expected_format | ||
assert cluster.default_config()["urls"] == [DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"]] | ||
assert cluster.default_config()["local_urls"] == [DEFAULT_WORKER_ENV["CELERY_RESULT_BACKEND"]] |
Oops, something went wrong.