summaryrefslogtreecommitdiff
path: root/unit_tests
diff options
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/test_hooks.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/unit_tests/test_hooks.py b/unit_tests/test_hooks.py
index 4573b2c..85331f7 100644
--- a/unit_tests/test_hooks.py
+++ b/unit_tests/test_hooks.py
@@ -3,6 +3,7 @@ from mock import patch, call
import hooks
from test_utils import CharmTestCase
+from test_utils import mock_open
from pymongo.errors import OperationFailure
from subprocess import CalledProcessError
@@ -339,3 +340,20 @@ class MongoHooksTest(CharmTestCase):
call1 = call('juju-local:27017', 'juju-remote:27017')
mock_leave_replset.assert_has_calls([call1])
+
+ def test_get_current_mongo_config(self):
+ test_config = u"""
+ # Comment
+ key = value
+ one=two
+
+ three =four
+ """
+ expected = {
+ 'key': 'value',
+ 'one': 'two',
+ 'three': 'four'
+ }
+ with mock_open('/etc/mongodb.conf', test_config):
+ results = hooks.get_current_mongo_config()
+ self.assertEqual(results, expected)