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
|
.testrepository
|
||||||
*__pycache__*
|
*__pycache__*
|
||||||
*.pyc
|
*.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',
|
self.assertEqual('/etc/keystone/domains/keystone.userdomain.conf',
|
||||||
charm.configuration_file)
|
charm.configuration_file)
|
||||||
|
|
||||||
|
@mock.patch('charmhelpers.contrib.openstack.utils.snap_install_requested')
|
||||||
@mock.patch('charmhelpers.core.hookenv.config')
|
@mock.patch('charmhelpers.core.hookenv.config')
|
||||||
@mock.patch('charmhelpers.core.hookenv.status_set')
|
@mock.patch('charmhelpers.core.hookenv.status_set')
|
||||||
@mock.patch('charmhelpers.core.hookenv.application_version_set')
|
@mock.patch('charmhelpers.core.hookenv.application_version_set')
|
||||||
def test_assess_status(self,
|
def test_assess_status(self,
|
||||||
application_version_set,
|
application_version_set,
|
||||||
status_set,
|
status_set,
|
||||||
config):
|
config, snap_install_requested):
|
||||||
reply = {
|
reply = {
|
||||||
'ldap-server': 'myserver',
|
'ldap-server': 'myserver',
|
||||||
'ldap-user': 'myusername',
|
'ldap-user': 'myusername',
|
||||||
|
@ -108,6 +109,7 @@ class TestKeystoneLDAPCharm(Helper):
|
||||||
return reply
|
return reply
|
||||||
config.side_effect = mock_config
|
config.side_effect = mock_config
|
||||||
|
|
||||||
|
snap_install_requested.return_value = False
|
||||||
# Check that active status is set correctly
|
# Check that active status is set correctly
|
||||||
keystone_ldap.assess_status()
|
keystone_ldap.assess_status()
|
||||||
status_set.assert_called_with('active', mock.ANY)
|
status_set.assert_called_with('active', mock.ANY)
|
||||||
|
|
Loading…
Reference in New Issue