summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorMasanori Itoh <itoumsn@nttdata.co.jp>2011-04-22 01:26:59 +0900
committerMasanori Itoh <itoumsn@nttdata.co.jp>2011-04-22 01:26:59 +0900
commit891eb82afacc10795e4ac05a0c8f817645db85c2 (patch)
tree9628fde3da56293ca8a39d0cd8ce120c489e8e4b /nova/tests
parentbc061d052f0faec69329dca80e5ef41954fbf171 (diff)
Utility method reworked, etc.
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_auth.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/nova/tests/test_auth.py b/nova/tests/test_auth.py
index f8a1b1564..3886e9e6b 100644
--- a/nova/tests/test_auth.py
+++ b/nova/tests/test_auth.py
@@ -25,6 +25,7 @@ from nova import log as logging
from nova import test
from nova.auth import manager
from nova.api.ec2 import cloud
+from nova.auth import authutils
FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.tests.auth_unittest')
@@ -339,6 +340,29 @@ class AuthManagerDbTestCase(_AuthManagerBaseTestCase):
auth_driver = 'nova.auth.dbdriver.DbDriver'
+class AuthManagerUtilTestCase(test.TestCase):
+ def test_get_host_only_server_string(self):
+ result = authutils.get_host_only_server_string('::1')
+ self.assertEqual('', result)
+ result = authutils.get_host_only_server_string('[::1]:8773')
+ self.assertEqual('::1', result)
+ result = authutils.get_host_only_server_string('2001:db8::192.168.1.1')
+ self.assertEqual('', result)
+ result = authutils.get_host_only_server_string(
+ '[2001:db8::192.168.1.1]:8773')
+ self.assertEqual('2001:db8::192.168.1.1', result)
+ result = authutils.get_host_only_server_string('192.168.1.1')
+ self.assertEqual('', result)
+ result = authutils.get_host_only_server_string('192.168.1.2:8773')
+ self.assertEqual('192.168.1.2', result)
+ result = authutils.get_host_only_server_string('192.168.1.3')
+ self.assertEqual('', result)
+ result = authutils.get_host_only_server_string('www.example.com:8443')
+ self.assertEqual('www.example.com', result)
+ result = authutils.get_host_only_server_string('www.example.com')
+ self.assertEqual('', result)
+
+
if __name__ == "__main__":
# TODO: Implement use_fake as an option
unittest.main()