Mock out calls to service_stop|start

Commit 01816c8 forgot to mock out calls to
service_start() and service_stop() that were
added to the install hook which causes test runs
to fail if not run as root.

Change-Id: I07e17242356a80e32c43c289b94c650a299e16b3
This commit is contained in:
Edward Hope-Morley 2017-10-04 19:02:26 +01:00
parent eaee5d4970
commit ca2f49f282
1 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,8 @@ class KeystoneRelationTests(CharmTestCase):
@patch.object(utils, 'os_release')
@patch.object(utils, 'git_install_requested')
@patch.object(unison, 'ensure_user')
@patch.object(hooks, 'service_stop', lambda *args: None)
@patch.object(hooks, 'service_start', lambda *args: None)
def test_install_hook(self, ensure_user, git_requested, os_release):
os_release.return_value = 'havana'
git_requested.return_value = False
@ -145,6 +147,8 @@ class KeystoneRelationTests(CharmTestCase):
@patch.object(utils, 'os_release')
@patch.object(utils, 'git_install_requested')
@patch.object(unison, 'ensure_user')
@patch.object(hooks, 'service_stop', lambda *args: None)
@patch.object(hooks, 'service_start', lambda *args: None)
def test_install_hook_apache2(self, ensure_user,
git_requested, os_release):
os_release.return_value = 'havana'
@ -168,6 +172,8 @@ class KeystoneRelationTests(CharmTestCase):
@patch.object(utils, 'os_release')
@patch.object(utils, 'git_install_requested')
@patch.object(unison, 'ensure_user')
@patch.object(hooks, 'service_stop', lambda *args: None)
@patch.object(hooks, 'service_start', lambda *args: None)
def test_install_hook_git(self, ensure_user, git_requested, os_release):
os_release.return_value = 'havana'
git_requested.return_value = True