libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject git commit: Use a better variable name ("scope_to" -> "toke_scope").
Date Thu, 14 Aug 2014 13:05:44 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 266ade557 -> b7a6c783d


Use a better variable name ("scope_to" -> "toke_scope").


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b7a6c783
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b7a6c783
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b7a6c783

Branch: refs/heads/trunk
Commit: b7a6c783d2bec762006fa475838d14507b61e61a
Parents: 266ade5
Author: Tomaz Muraus <tomaz@apache.org>
Authored: Thu Aug 14 14:55:42 2014 +0200
Committer: Tomaz Muraus <tomaz@apache.org>
Committed: Thu Aug 14 15:01:51 2014 +0200

----------------------------------------------------------------------
 libcloud/common/openstack_identity.py           | 26 ++++++++++----------
 libcloud/test/common/test_openstack_identity.py | 16 ++++++------
 2 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b7a6c783/libcloud/common/openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py
index f208258..d468e73 100644
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -880,22 +880,22 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
     auth_version = '3.0'
 
     def __init__(self, auth_url, user_id, key, tenant_name=None,
-                 domain_name='Default', scope_to='project',
+                 domain_name='Default', token_scope='project',
                  timeout=None, parent_conn=None):
         """
         :param tenant_name: Name of the project this user belongs to. Note:
-                            When scope_to is set to project, this argument
+                            When token_scope is set to project, this argument
                             control to which project to scope the token to.
         :type tenant_name: ``str``
 
-        :param domain_name: Domain the user belongs to. Note: Then scope_to
+        :param domain_name: Domain the user belongs to. Note: Then token_scope
                             is set to token, this argument controls to which
                             domain to scope the token to.
         :type domain_name: ``str``
 
-        :param scope_to: Whether to scope a token to a "project" or a
+        :param token_scope: Whether to scope a token to a "project" or a
                          "domain"
-        :type scope_to: ``str``
+        :type token_scope: ``str``
         """
         super(OpenStackIdentity_3_0_Connection,
               self).__init__(auth_url=auth_url,
@@ -904,19 +904,19 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
                              tenant_name=tenant_name,
                              timeout=timeout,
                              parent_conn=parent_conn)
-        if scope_to not in ['project', 'domain']:
-            raise ValueError('Invalid value for "scope_to" argument: %s' %
-                             (scope_to))
+        if token_scope not in ['project', 'domain']:
+            raise ValueError('Invalid value for "token_scope" argument: %s' %
+                             (token_scope))
 
-        if scope_to == 'project' and (not tenant_name or not domain_name):
+        if token_scope == 'project' and (not tenant_name or not domain_name):
             raise ValueError('Must provide tenant_name and domain_name '
                              'argument')
-        elif scope_to == 'domain' and not domain_name:
+        elif token_scope == 'domain' and not domain_name:
             raise ValueError('Must provide domain_name argument')
 
         self.tenant_name = tenant_name
         self.domain_name = domain_name
-        self.scope_to = scope_to
+        self.token_scope = token_scope
         self.auth_user_roles = None
 
     def authenticate(self, force=False):
@@ -943,7 +943,7 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
             }
         }
 
-        if self.scope_to == 'project':
+        if self.token_scope == 'project':
             # Scope token to project (tenant)
             data['auth']['scope'] = {
                 'project': {
@@ -953,7 +953,7 @@ class OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
                     'name': self.tenant_name
                 }
             }
-        elif self.domain_name:
+        elif self.token_scope == 'domain':
             # Scope token to domain
             data['auth']['scope'] = {
                 'domain': {

http://git-wip-us.apache.org/repos/asf/libcloud/blob/b7a6c783/libcloud/test/common/test_openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/test/common/test_openstack_identity.py b/libcloud/test/common/test_openstack_identity.py
index 20ec116..3cbab15 100644
--- a/libcloud/test/common/test_openstack_identity.py
+++ b/libcloud/test/common/test_openstack_identity.py
@@ -233,15 +233,15 @@ class OpenStackIdentity_3_0_ConnectionTests(unittest.TestCase):
                                                               tenant_name='test')
         self.auth_instance.auth_token = 'mock'
 
-    def test_scope_to_argument(self):
-        # Invalid scope_to value
-        expected_msg = 'Invalid value for "scope_to" argument: foo'
+    def test_token_scope_argument(self):
+        # Invalid token_scope value
+        expected_msg = 'Invalid value for "token_scope" argument: foo'
         self.assertRaisesRegexp(ValueError, expected_msg,
                                 OpenStackIdentity_3_0_Connection,
                                 auth_url='http://none',
                                 user_id='test',
                                 key='test',
-                                scope_to='foo')
+                                token_scope='foo')
 
         # Missing tenant_name
         expected_msg = 'Must provide tenant_name and domain_name argument'
@@ -250,7 +250,7 @@ class OpenStackIdentity_3_0_ConnectionTests(unittest.TestCase):
                                 auth_url='http://none',
                                 user_id='test',
                                 key='test',
-                                scope_to='project')
+                                token_scope='project')
 
         # Missing domain_name
         expected_msg = 'Must provide domain_name argument'
@@ -259,21 +259,21 @@ class OpenStackIdentity_3_0_ConnectionTests(unittest.TestCase):
                                 auth_url='http://none',
                                 user_id='test',
                                 key='test',
-                                scope_to='domain',
+                                token_scope='domain',
                                 domain_name=None)
 
         # Scope to project all ok
         OpenStackIdentity_3_0_Connection(auth_url='http://none',
                                          user_id='test',
                                          key='test',
-                                         scope_to='project',
+                                         token_scope='project',
                                          tenant_name='test',
                                          domain_name='Default')
         # Scope to domain
         OpenStackIdentity_3_0_Connection(auth_url='http://none',
                                          user_id='test',
                                          key='test',
-                                         scope_to='domain',
+                                         token_scope='domain',
                                          tenant_name=None,
                                          domain_name='Default')
 


Mime
View raw message