diff --git a/src/reactive/aodh_handlers.py b/src/reactive/aodh_handlers.py index f6e8e7a..712ff81 100644 --- a/src/reactive/aodh_handlers.py +++ b/src/reactive/aodh_handlers.py @@ -13,7 +13,6 @@ # limitations under the License. import charms.reactive as reactive -import charmhelpers.core.hookenv as hookenv # This charm's library contains all of the handler code associated with # aodh @@ -51,7 +50,7 @@ def setup_database(database): """On receiving database credentials, configure the database on the interface. """ - database.configure('aodh', 'aodh', hookenv.unit_private_ip()) + database.configure('aodh', 'aodh') aodh.assess_status() diff --git a/unit_tests/test_aodh_handlers.py b/unit_tests/test_aodh_handlers.py index 2a1bd3e..df31771 100644 --- a/unit_tests/test_aodh_handlers.py +++ b/unit_tests/test_aodh_handlers.py @@ -88,11 +88,12 @@ class TestAodhHandlers(unittest.TestCase): self._patches = None self._patches_start = None - def patch(self, obj, attr, return_value=None): + def patch(self, obj, attr, return_value=None, side_effect=None): mocked = mock.patch.object(obj, attr) self._patches[attr] = mocked started = mocked.start() started.return_value = return_value + started.side_effect = side_effect self._patches_start[attr] = started setattr(self, attr, started) @@ -152,11 +153,9 @@ class TestAodhHandlers(unittest.TestCase): def test_database(self): database = mock.MagicMock() - self.patch(handlers.hookenv, 'unit_private_ip', 'private_ip') self.patch(handlers.aodh, 'assess_status') handlers.setup_database(database) - database.configure.assert_called_once_with( - 'aodh', 'aodh', 'private_ip') + database.configure.assert_called_once_with('aodh', 'aodh') def test_setup_endpoint(self): self.patch(handlers.aodh, 'setup_endpoint')