Mock snap_install_requested in unit tests
Unit test for layered charms fail due to the new snap support. snap_install_requested must be mocked out. Change-Id: Id2e10f436300813a6c223ef4148cd82bd6f46ba5 Closes-Bug: #1722587
This commit is contained in:
parent
b4a2fb2bf8
commit
a780e72d81
|
@ -5,3 +5,4 @@ interfaces
|
|||
.testrepository
|
||||
*__pycache__*
|
||||
*.pyc
|
||||
.stestr
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[DEFAULT]
|
||||
test_path=./unit_tests
|
||||
top_dir=./
|
|
@ -88,13 +88,14 @@ class TestKeystoneLDAPCharm(Helper):
|
|||
self.assertEqual('/etc/keystone/domains/keystone.userdomain.conf',
|
||||
charm.configuration_file)
|
||||
|
||||
@mock.patch('charmhelpers.contrib.openstack.utils.snap_install_requested')
|
||||
@mock.patch('charmhelpers.core.hookenv.config')
|
||||
@mock.patch('charmhelpers.core.hookenv.status_set')
|
||||
@mock.patch('charmhelpers.core.hookenv.application_version_set')
|
||||
def test_assess_status(self,
|
||||
application_version_set,
|
||||
status_set,
|
||||
config):
|
||||
config, snap_install_requested):
|
||||
reply = {
|
||||
'ldap-server': 'myserver',
|
||||
'ldap-user': 'myusername',
|
||||
|
@ -108,6 +109,7 @@ class TestKeystoneLDAPCharm(Helper):
|
|||
return reply
|
||||
config.side_effect = mock_config
|
||||
|
||||
snap_install_requested.return_value = False
|
||||
# Check that active status is set correctly
|
||||
keystone_ldap.assess_status()
|
||||
status_set.assert_called_with('active', mock.ANY)
|
||||
|
|
Loading…
Reference in New Issue