mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
switch to new nested with pattern from PR review
This commit is contained in:
@@ -14,24 +14,25 @@ def test_routing_of_service_restarts_works(mocker):
|
|||||||
This tests that the parent restart method will call the appropriate
|
This tests that the parent restart method will call the appropriate
|
||||||
service restart methods, depending on which services are given in args
|
service restart methods, depending on which services are given in args
|
||||||
'''
|
'''
|
||||||
with mocker.patch.object(reload, '_uwsgi_reload'):
|
with mocker.patch.object(reload, '_uwsgi_reload'),\
|
||||||
with mocker.patch.object(reload, '_reset_celery_thread_pool'):
|
mocker.patch.object(reload, '_reset_celery_thread_pool'),\
|
||||||
with mocker.patch.object(reload, '_supervisor_service_restart'):
|
mocker.patch.object(reload, '_supervisor_service_restart'):
|
||||||
reload.restart_local_services(['uwsgi', 'celery', 'flower', 'daphne'])
|
reload.restart_local_services(['uwsgi', 'celery', 'flower', 'daphne'])
|
||||||
reload._uwsgi_reload.assert_called_once_with()
|
reload._uwsgi_reload.assert_called_once_with()
|
||||||
reload._reset_celery_thread_pool.assert_called_once_with()
|
reload._reset_celery_thread_pool.assert_called_once_with()
|
||||||
reload._supervisor_service_restart.assert_called_once_with(['flower', 'daphne'])
|
reload._supervisor_service_restart.assert_called_once_with(['flower', 'daphne'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_routing_of_service_restarts_diables(mocker):
|
def test_routing_of_service_restarts_diables(mocker):
|
||||||
'''
|
'''
|
||||||
Test that methods are not called if not in the args
|
Test that methods are not called if not in the args
|
||||||
'''
|
'''
|
||||||
with mocker.patch.object(reload, '_uwsgi_reload'):
|
with mocker.patch.object(reload, '_uwsgi_reload'),\
|
||||||
with mocker.patch.object(reload, '_reset_celery_thread_pool'):
|
mocker.patch.object(reload, '_reset_celery_thread_pool'),\
|
||||||
with mocker.patch.object(reload, '_supervisor_service_restart'):
|
mocker.patch.object(reload, '_supervisor_service_restart'):
|
||||||
reload.restart_local_services(['flower'])
|
reload.restart_local_services(['flower'])
|
||||||
reload._uwsgi_reload.assert_not_called()
|
reload._uwsgi_reload.assert_not_called()
|
||||||
reload._reset_celery_thread_pool.assert_not_called()
|
reload._reset_celery_thread_pool.assert_not_called()
|
||||||
reload._supervisor_service_restart.assert_called_once_with(['flower'])
|
reload._supervisor_service_restart.assert_called_once_with(['flower'])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user