mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
clear the test cache at end of every test
This commit is contained in:
parent
30352e375f
commit
07def62373
@ -14,6 +14,8 @@ from awx.main.tests.factories import (
|
||||
create_workflow_job_template,
|
||||
)
|
||||
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
@ -130,3 +132,10 @@ def mock_cache():
|
||||
|
||||
return MockCache()
|
||||
|
||||
|
||||
def pytest_runtest_teardown(item, nextitem):
|
||||
# clear Django cache at the end of every test ran
|
||||
# NOTE: this should not be memcache, see test_cache in test_env.py
|
||||
# this is a local test cache, so we want every test to start with empty cache
|
||||
cache.clear()
|
||||
|
||||
|
@ -75,9 +75,11 @@ def test_awx_task_env_validity(get, patch, admin, value, expected):
|
||||
url = reverse('api:setting_singleton_detail', kwargs={'category_slug': 'jobs'})
|
||||
patch(url, user=admin, data={'AWX_TASK_ENV': value}, expect=expected)
|
||||
|
||||
resp = get(url, user=admin)
|
||||
if expected == 200:
|
||||
resp = get(url, user=admin)
|
||||
assert resp.data['AWX_TASK_ENV'] == dict((k, str(v)) for k, v in value.items())
|
||||
else:
|
||||
assert resp.data['AWX_TASK_ENV'] == dict()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
|
Loading…
Reference in New Issue
Block a user