1
from testtools import TestCase
2
from mock import call, patch, MagicMock
7
class NRPEHooksTest(TestCase):
9
@patch('hooks.install_nrpe_scripts')
10
@patch('charmhelpers.contrib.charmsupport.nrpe.NRPE')
11
def test_update_nrpe_config(self, nrpe, install_nrpe_scripts):
12
nrpe_compat = MagicMock()
13
nrpe_compat.checks = [MagicMock(shortname="haproxy"),
14
MagicMock(shortname="haproxy_queue")]
15
nrpe.return_value = nrpe_compat
17
hooks.update_nrpe_config()
20
nrpe_compat.mock_calls,
21
[call.add_check('haproxy', 'Check HAProxy', 'check_haproxy.sh'),
22
call.add_check('haproxy_queue', 'Check HAProxy queue depth',
23
'check_haproxy_queue_depth.sh'),