summaryrefslogtreecommitdiff
path: root/troveclient/tests/test_utils.py
diff options
context:
space:
mode:
authorMichael Basnight <mbasnight@gmail.com>2013-06-17 23:34:27 -0700
committerMichael Basnight <mbasnight@gmail.com>2013-06-21 20:15:23 +0000
commit9916c8f2733b683d859770d05dacd2c9c82912d7 (patch)
tree084a0d53580cbbd34ed8f28de9302d6c78f7050d /troveclient/tests/test_utils.py
parentbc90b3e088d3d4b83b5b3de0f9f83d9b6956947d (diff)
downloadpython-troveclient-9916c8f2733b683d859770d05dacd2c9c82912d7.tar.gz
Rename from reddwarf to trove.0.1.3
Implements Blueprint reddwarf-trove-rename Change-Id: Ib2d694c7466887ca297bea4250eca17cdc06b7bf
Diffstat (limited to 'troveclient/tests/test_utils.py')
-rw-r--r--troveclient/tests/test_utils.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/troveclient/tests/test_utils.py b/troveclient/tests/test_utils.py
new file mode 100644
index 0000000..12ee9d0
--- /dev/null
+++ b/troveclient/tests/test_utils.py
@@ -0,0 +1,41 @@
+import os
+from testtools import TestCase
+from troveclient import utils
+from troveclient import versions
+
+
+class UtilsTest(TestCase):
+
+ def test_add_hookable_mixin(self):
+ def func():
+ pass
+
+ hook_type = "hook_type"
+ mixin = utils.HookableMixin()
+ mixin.add_hook(hook_type, func)
+ self.assertTrue(hook_type in mixin._hooks_map)
+ self.assertTrue(func in mixin._hooks_map[hook_type])
+
+ def test_run_hookable_mixin(self):
+ def func():
+ pass
+
+ hook_type = "hook_type"
+ mixin = utils.HookableMixin()
+ mixin.add_hook(hook_type, func)
+ mixin.run_hooks(hook_type)
+
+ def test_environment(self):
+ self.assertEqual('', utils.env())
+ self.assertEqual('passing', utils.env(default='passing'))
+
+ os.environ['test_abc'] = 'passing'
+ self.assertEqual('passing', utils.env('test_abc'))
+ self.assertEqual('', utils.env('test_abcd'))
+
+ def test_slugify(self):
+ import unicodedata
+
+ self.assertEqual('not_unicode', utils.slugify('not_unicode'))
+ self.assertEqual('unicode', utils.slugify(unicode('unicode')))
+ self.assertEqual('slugify-test', utils.slugify('SLUGIFY% test!'))