summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-01-04 10:40:07 +0000
committerGerrit Code Review <review@openstack.org>2015-01-04 10:40:07 +0000
commit7ce1ff9325be702384d728ad6a94f597680e1707 (patch)
tree51444a606993f9c661414f192c8f9c5daf69ebf5
parente3600ad7beb7cb4a067038d750e530a64fd1e93a (diff)
parentbd73a5482ca8174b6ac83b26ae09cac0e82a468e (diff)
downloadpython-glanceclient-7ce1ff9325be702384d728ad6a94f597680e1707.tar.gz
Merge "Add os_ prefix to project_domain_name/id"
-rw-r--r--glanceclient/shell.py6
-rw-r--r--tests/test_shell.py16
2 files changed, 19 insertions, 3 deletions
diff --git a/glanceclient/shell.py b/glanceclient/shell.py
index 31891e6..4eb174e 100644
--- a/glanceclient/shell.py
+++ b/glanceclient/shell.py
@@ -480,12 +480,12 @@ class OpenStackImagesShell(object):
project_info = (args.os_tenant_name or
args.os_tenant_id or
(args.os_project_name and
- (args.project_domain_name or
- args.project_domain_id)) or
+ (args.os_project_domain_name or
+ args.os_project_domain_id)) or
args.os_project_id)
if (not project_info):
- # tenent is deprecated in Keystone v3. Use the latest
+ # tenant is deprecated in Keystone v3. Use the latest
# terminology instead.
raise exc.CommandError(
_("You must provide a project_id or project_name ("
diff --git a/tests/test_shell.py b/tests/test_shell.py
index effaedb..0327db7 100644
--- a/tests/test_shell.py
+++ b/tests/test_shell.py
@@ -273,6 +273,22 @@ class ShellTest(utils.TestCase):
# Make sure we are actually prompted.
mock_getpass.assert_called_with('OS Password: ')
+ @mock.patch(
+ 'glanceclient.shell.OpenStackImagesShell._get_keystone_session')
+ @mock.patch.object(openstack_shell.OpenStackImagesShell, '_cache_schemas')
+ def test_no_auth_with_proj_name(self, cache_schemas, session):
+ with mock.patch('glanceclient.v2.client.Client'):
+ args = ('--os-project-name myname '
+ '--os-project-domain-name mydomain '
+ '--os-project-domain-id myid '
+ '--os-image-api-version 2 image-list')
+ glance_shell = openstack_shell.OpenStackImagesShell()
+ glance_shell.main(args.split())
+ ((args), kwargs) = session.call_args
+ self.assertEqual('myname', kwargs['project_name'])
+ self.assertEqual('mydomain', kwargs['project_domain_name'])
+ self.assertEqual('myid', kwargs['project_domain_id'])
+
class ShellTestWithKeystoneV3Auth(ShellTest):
# auth environment to use