You need to mock out get_local_endpoint: ====================================================================== ERROR: test_add_service_to_keystone_clustered_https_none_values (unit_tests.test_keystone_utils.TestKeystoneUtils) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mock.py", line 1210, in patched return func(*args, **keywargs) File "/home/jamespage/src/charms/icehouse/keystone/unit_tests/test_keystone_utils.py", line 158, in test_add_service_to_keystone_clustered_https_none_values utils.add_service_to_keystone(relation_id=relation_id, remote_unit=remote_unit) File "hooks/keystone_utils.py", line 608, in add_service_to_keystone manager = manager.KeystoneManager(endpoint=get_local_endpoint(), File "hooks/keystone_utils.py", line 272, in get_local_endpoint determine_api_port(api_port('keystone-admin')) File "hooks/charmhelpers/contrib/hahelpers/cluster.py", line 122, in determine_api_port if len(peer_units()) > 0 or is_clustered(): File "hooks/charmhelpers/contrib/hahelpers/cluster.py", line 59, in peer_units for r_id in (relation_ids('cluster') or []): File "hooks/charmhelpers/core/hookenv.py", line 44, in wrapper res = func(*args, **kwargs) File "hooks/charmhelpers/core/hookenv.py", line 213, in relation_ids return json.loads(subprocess.check_output(relid_cmd_line)) or [] File "/usr/lib/python2.7/subprocess.py", line 566, in check_output process = Popen(stdout=PIPE, *popenargs, **kwargs) File "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory ====================================================================== ERROR: test_add_service_to_keystone_no_clustered_no_https_complete_values (unit_tests.test_keystone_utils.TestKeystoneUtils) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mock.py", line 1210, in patched return func(*args, **keywargs) File "/home/jamespage/src/charms/icehouse/keystone/unit_tests/test_keystone_utils.py", line 196, in test_add_service_to_keystone_no_clustered_no_https_complete_values utils.add_service_to_keystone(relation_id=relation_id, remote_unit=remote_unit) File "hooks/keystone_utils.py", line 608, in add_service_to_keystone manager = manager.KeystoneManager(endpoint=get_local_endpoint(), File "hooks/keystone_utils.py", line 272, in get_local_endpoint determine_api_port(api_port('keystone-admin')) File "hooks/charmhelpers/contrib/hahelpers/cluster.py", line 122, in determine_api_port if len(peer_units()) > 0 or is_clustered(): File "hooks/charmhelpers/contrib/hahelpers/cluster.py", line 59, in peer_units for r_id in (relation_ids('cluster') or []): File "hooks/charmhelpers/core/hookenv.py", line 44, in wrapper res = func(*args, **kwargs) File "hooks/charmhelpers/core/hookenv.py", line 213, in relation_ids return json.loads(subprocess.check_output(relid_cmd_line)) or [] File "/usr/lib/python2.7/subprocess.py", line 566, in check_output process = Popen(stdout=PIPE, *popenargs, **kwargs) File "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory ====================================================================== ERROR: test_add_service_to_keystone_nosubset (unit_tests.test_keystone_utils.TestKeystoneUtils) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mock.py", line 1210, in patched return func(*args, **keywargs) File "/home/jamespage/src/charms/icehouse/keystone/unit_tests/test_keystone_utils.py", line 228, in test_add_service_to_keystone_nosubset utils.add_service_to_keystone(relation_id=relation_id, remote_unit=remote_unit) File "hooks/keystone_utils.py", line 608, in add_service_to_keystone manager = manager.KeystoneManager(endpoint=get_local_endpoint(), File "hooks/keystone_utils.py", line 272, in get_local_endpoint determine_api_port(api_port('keystone-admin')) File "hooks/charmhelpers/contrib/hahelpers/cluster.py", line 122, in determine_api_port if len(peer_units()) > 0 or is_clustered(): File "hooks/charmhelpers/contrib/hahelpers/cluster.py", line 59, in peer_units for r_id in (relation_ids('cluster') or []): File "hooks/charmhelpers/core/hookenv.py", line 44, in wrapper res = func(*args, **kwargs) File "hooks/charmhelpers/core/hookenv.py", line 213, in relation_ids return json.loads(subprocess.check_output(relid_cmd_line)) or [] File "/usr/lib/python2.7/subprocess.py", line 566, in check_output process = Popen(stdout=PIPE, *popenargs, **kwargs) File "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory and filter_installed_packages: ====================================================================== FAIL: test_upgrade_charm_leader (unit_tests.test_keystone_hooks.KeystoneRelationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mock.py", line 1210, in patched return func(*args, **keywargs) File "/home/jamespage/src/charms/icehouse/keystone/unit_tests/test_keystone_hooks.py", line 347, in test_upgrade_charm_leader 'pwgen', 'keystone', 'python-psycopg2']) File "/usr/lib/python2.7/dist-packages/mock.py", line 844, in assert_called_with raise AssertionError(msg) AssertionError: Expected call: apt_install(['haproxy', 'unison', 'uuid', 'python-mysqldb', 'pwgen', 'keystone', 'python-psycopg2']) Actual call: apt_install(['haproxy', 'unison', 'keystone', 'python-psycopg2']) ====================================================================== FAIL: test_upgrade_charm_not_leader (unit_tests.test_keystone_hooks.KeystoneRelationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/mock.py", line 1210, in patched return func(*args, **keywargs) File "/home/jamespage/src/charms/icehouse/keystone/unit_tests/test_keystone_hooks.py", line 360, in test_upgrade_charm_not_leader 'pwgen', 'keystone', 'python-psycopg2']) File "/usr/lib/python2.7/dist-packages/mock.py", line 844, in assert_called_with raise AssertionError(msg) AssertionError: Expected call: apt_install(['haproxy', 'unison', 'uuid', 'python-mysqldb', 'pwgen', 'keystone', 'python-psycopg2']) Actual call: apt_install(['haproxy', 'unison', 'keystone', 'python-psycopg2'])